Query a CSV using SQL
Query a CSV using SQL. Wrk Action uses SQLite syntax.
SQLLite Documentation: https://www.sqlite.org/docs.html
Application
- CSV
Inputs (what you have)
| Name | Description | Data Type | Required? | Example |
|---|---|---|---|---|
| CSV file | CSV file you would like to query using SQL | File | Yes | |
| SQL query | A SQL query to perform on the provided CSV. Your primary table will always be referenced as CSV. Example: Select * from CSV | Text (Long) | Yes | Select * from CSV |
| Columns do not have headers? | If selected, the headers will be referred to as Col1, Col2, etc | True/False | No | |
| Separator | The character used to separate columns in the CSV. Will default to , | Text (Short) | No | , |
| Quote character | The characters used to indicate a string in the CSV. Will default to “ | Text (Short) | No | “ |
| Preserve null-like text | Keep literal text such as NA, NULL, null, NaN and N/A instead of SQL NULL. Defaults to false. Empty cells still become SQL NULL. | True/False | No | false |
| Output filename | Optional custom filename for the output CSV file | Text(Long) | No | sample.csv |
Leading zeros and column types
Columns containing integers with leading zeros, such as 00123 or 00007, are
automatically treated as text. The entire column keeps its text values, so 00123
and 123 remain distinct in queries and in the CSV and JSON results. Other columns
continue to use automatic type detection. A single zero (0) or an ordinary
decimal (0.50) does not cause a column to be treated as text.
Use quoted text values when filtering these columns, for example
WHERE account_id = '00123'. To compare or sort them numerically, use
CAST(account_id AS INTEGER). Configure captured identifier outputs as Text to
preserve their leading zeros.
Empty cells and null-like text
By default, empty cells and recognized null-like text, including NA, NULL,
null, NaN and N/A, become SQL NULL. Quoting these values does not preserve
them under the default setting.
Enable Preserve null-like text to keep these literal strings. For example,
WHERE value = 'NA' then matches both NA and "NA" in the source CSV.
Empty cells, including quoted empty cells (""), still become SQL NULL; use
WHERE value IS NULL to find them. CSV has no separate native null type, and
SQL-generated NULL values remain null.
The setting defaults to false, so existing Wrkflows retain their null handling.
It only changes null-token recognition: other column type detection and the
parsing of JSON objects and arrays in JSON outputs still apply. In the output CSV,
SQL NULL is written as an empty cell.
Outputs (what you get)
| Name | Description | Data Type | Required? | Example |
|---|---|---|---|---|
| Output CSV | Output CSV file | File | Yes |
Outcomes
| Name | Description |
|---|---|
| Success | This status is selected if the job has successfully completed. |
Examples:
- Examples to come