ImportCsvText
Similar to CsvToArray, the ImportCsvText() function converts a block of CSV-formatted data into an array. However, this function also allows you to apply filter expressions and specify which columns should be returned.
In the source data, columns are delimited by commas, and rows are delimited by newline characters.
Syntax:
Qx.ImportCsvText(Text, [Filter Expression], [Columns])- In Excel with Quintessence addin versions prior to 25.1, use:
ImportCsvText() - In the Quintessence Editor (Studio) using Quintessence language, use:
ImportCsvText() - In the Quintessence Editor (Studio) using Python language, use:
Qx.ImportCsvText()
ⓘ See parameter descriptions
| Text | The CSV text to import. |
| Filter Expression (optional) | The expression representing the filter criteria to apply to the data. |
| Columns (optional) | The columns to return, represented as Cn. By default, columns are imported as text. The format can be changed using the following options:• Convert column to number: Cn:N• Convert column to date: Cn:D• Convert column to text: Cn:T |
Remarks:
- Unless changed by an administrator, the default parameters are:
- Filter Expression: No filter is applied to the imported data.
- Columns:
*(all columns are imported).
Examples:
The examples provided below are based on fictitious data for illustrative purposes only.
> Example 1: Convert CSV data to array
CSV Text:
ABC1,2000-10-05,51
ABC2,2000-10-05,65Formula:
=Qx.CsvToArray(CSV Text)Result:
| ABC1 | 2000-10-05 | 51 |
| ABC2 | 2000-10-05 | 65 |
> Example 2: Convert CSV data to array that meets specific criteria
CSV Text:
Stock, Date, Value
ABC1, 2000-10-05, 51
ABC2, 6 October 2000, 65Goal is to return rows where the third column is greater than 55, ensuring column 2 is formatted as a date and column 3 as a number.
=Qx.ImportCsvText(CSV Text, "Line = 1 || C3 > 55", "C1, C2:D, C3:N")Result:
| Stock | Date | Value |
| ABC2 | 2000-10-06 | 65 |
