CSV Parser component
Parses the input CSV string according to the specified output format. This operation is the reverse of CSV Formatter.
In-ports
input String
— input CSV string.
columns Array
— an array of strings that represents the headers of the columns in the input string.
Out-ports
output Array
— the resulting array parsed from the input string.
columns Array
— array of column headers in the resulting array.
Overview
CSV Parser component parses the input CSV comma-separated values string returning an array of arrays or array of objects. It also supports parsing strings in TSV (tab-separated values) format and let you specify a custom delimiter symbol.
To parse a string, pass it to the input port. The input string may include a header line containing names of the columns in the same format as other lines. Alternatively, headers can be passed in a separate array to the columns in-port. The output port will emit the array parsed from the input string. Headers are emitted separately on the columns out-port.
ⓘ NOTE
The values themselves in the CSV (and other compatible formats) are always strings; they will not be automatically converted to numbers. You can do the conversion after parsing the input using the transformations.
Data examples
An example of a CSV input string:
Year,Make,Model,Length
1997,Ford,E350,2.34
2000,Mercury,Cougar,2.38
This input parsed into array of objects:
[
{ "Year": "1997", "Make": "Ford", "Model": "E350", "Length": "2.34" },
{ "Year": "2000", "Make": "Mercury", "Model": "Cougar", "Length": "2.38" }
]
The same input parsed into array of arrays:
[
["Year", "Make", "Model", "Length"],
["1997", "Ford", "E350", "2.34"],
["2000", "Mercury", "Cougar", "2.38"]
]
Settings
Input format
Specifies the input string format:
- CSV (Comma-separated values)
- TSV (Tab-separated values)
- Custom delimiter
Delimiter
Specifies the delimiter symbol used to separate row elements. For example, a semicolon (;) or vertical bar (|).
Output format
Specifies whether the input string is parsed to an array of arrays or an array of objects.
Headings in the first row
Specifies whether headers are included in the first line of the input string or passed to the columns in-port. When parsing into an object array, make sure that the headers are passed in one way or another.