Source data from your CSV files.

The Spreadsheet component allows you to perform queries regarding your CSV spreadsheet data. For example, if the spreadsheet is a customer list with address information, you can make queries such as "Where are the most customers geographically located?".

Initially, the Spreadsheet component has no files loaded, however once you upload a CSV file by clicking on the "Click to upload" area of the UI component, the UI will change to allow you to further specify relevant options.

Once you have selected your source CSV file(s), the Spreadsheet component uploads the CSV table into an automatically named Diaflow Database table. The created data table can be viewed in the Database Workspace Resources. Please refer to the Database section for more information on Workspace Database Resources.

Note that the upload to the Diaflow database occurs only once if the "Enable Caching" option has been selected. Be sure to disable caching if your CSV file is not static, however please also note that there is performance cost for disabling caching, as your data will be refreshed from the source CSV file on each execution of the Flow.

Once the Data is in an appropriate data table, the Spreadsheet component can either generate an SQL query based on your natural language query by running your natural text query through a selectable LLM, or alternatively you can specify your SQL manually.

The choice is made through the "SQL Generate Method" dropdown menu on the Spreadsheet Component UI. Once an option is selected, the UI for the Spreadsheet component changes accordingly to provide you with access to the relevant parameters for each method. Please refer to the Parameters section for detailed information on the relevant parameters for each method.

The Spreadsheet component has the identifier of tbl-X, where X represents the instance number of the Spreadsheet component.

The Diaflow Database component has the following parameters that can be specified directly on the UI component.

Parameter NameDescription


This parameter specifies what action is desired regarding the database table. Available values: - Query data from the table.

SQL Generate Method

Use AI In this mode, the Spreadsheet component will either generate an SQL query based on your natural language query. Manually Enter SQL In this mode, the Spreadsheet component UI changes to allow you to specify your SQL manually.

The following sections detail the use of the SQL Generate Method-specific parameters. The Spreadsheet component UI changes to accommodate the various different options of each method, depending on the selected SQL Generate Method parameter.

SQL Generate Method - Use AI

If the "Use AI" method is selected, the Spreadsheet component UI changes to allow the selection of relevant AI parameters.

The parameters specific to the "Use AI" mode are detailed below.

Input Dropdown Selector

In "Use AI" mode, the Spreadsheet Component generates the SQL query automatically based on a natural language query (From Text Input) by using the selected LLM Provider. This input is selected by the "Input" dropdown menu.

Note that for any items to appear in the "Input" dropdown menu, you must connect the relevant "Text Input" component to the "From Text Input" input of the Spreadsheet component. Once connected, the input will become available to select in the dropdown.

Provider Dropdown Selector

Specifies the desired LLM provider. The selected LLM Provider can be changed by clicking the "Show Prompt" button. Once clicked, the Spreadsheet component UI changes to allow selection of AI parameters.

Note that some LLM models are not available to select, due to limitations in generating SQL that exist with some LLM providers. For more information on LLMs, please refer to the Models section.

Credentials Dropdown Selector

You can use Diaflow credentials for the LLM provider, or alternatively you can use your own credentials stored in the Workspace Resources section of the Dashboard. For more information on creating and using your own credentials, please refer to Resources section.

Model Dropdown Selector

This selects the particular LLM model version available from each provider. Because the available options are specific to the selected LLM Provider, the available dropdown items will change depending on the selected Provider. For more information on the specifics of each LLM, please refer to the Models section.

System Text Field

This describes to the LLM how to interact, in this case to generate SQL from the natural language input query.

Prompt Text Field

This query can be viewed within the Spreadsheet UI component. When the Spreadsheet component is executed as part of the Flow, the automatically generated SQL query is run, and the results (JSON) can for example, be fed into another LLM for further processing.

SQL Generate Method - Manually Enter SQL

If the "Manually Enter SQL" method is selected, the Spreadsheet component UI changes to allow you to specify your SQL manually.

The Spreadsheet Component has the following input connections.

Input NameDescriptionConstraints

From Input

This input connection captures your natural language query, and is used by the Spreadsheet Component to generate an equivalent SQL query, if the Spreadsheet Component is in "Use AI" mode.

If the Spreadsheet Component is in "Manually Enter SQL" mode, then this parameter is ignored.

This is an optional parameter used only if the "SQL Generate Method" is set to "Use AI".

If this input is used, it must originate from a Text Input Component.

Component Outputs

The Spreadsheet Component has the following output connections.

Output Name FormatDescriptionConstraints

To VectorDB/Python/LLM

This output connection contains JSON text data that represents the answer to the automatically generated SQL.

Must be connected to the following Component types:

  • LLM Component.

  • Vector Database.

  • Python.

  • Text Output.

Note that the generated JSON results from the Spreadsheet component can be observed by connecting the output connection ("To VectorDB/Python/LLM") from the Spreadsheet Component to a Text Output Component.

The Spreadsheet Component has the following mode-independent configuration options.

Configuration Option NameDescription


This is a user supplied textual description of the Spreadsheet Component.

Enable Caching

This option determines whether the results of the component are cached. This means that on the next run of the Flow, Diaflow will utilize the previous computed component output, as long as the inputs have not changed.

Caching Time

Only applicable if the "Enable Caching" option has been enabled. This parameter controls how long Diaflow will wait before automatically clearing the cache.

Use Cases

The following is a simple use case of the Spreadsheet component, where the Spreadsheet component is being used to query an CSV file containing customer addresses. With this example Flow, the Spreadsheet is using OpenAI to generate the output SQL.

You can also view the SQL that is generated by the Spreadsheet component by connecting an Output Text component to the output of the Spreadsheet block.

Last updated