Skip to main content

$$csvparse

Converts a CSV string into an array of objects/arrays

Usage​

{
"$$csvparse": "...",
"no_headers": false,
"separator": ",",
"names": [ /* names */ ]
}
"$$csvparse([no_headers],[separator],[names]):{input}"

Returns​

string

Arguments​

ArgumentTypeValuesRequired / Default ValueDescription
no_headersbooleanfalse/truefalseWhether to treat the first row as object keys
separatorstringfalse/true","Use an alternative field separator
namesstring[](Names taken from the first object)Names of fields of input arrays (by indices) or objects (can sift if provided less names than there are in the objects provided)

Examples​

Input

Definition

Output

a
","
{
"$$csvparse": "$"
}
[{ "a": "," }]
a
""""
{
"$$csvparse": "$"
}
[{ "a": "\"" }]
1,2
3,4
{
"$$csvparse": "$",
"no_headers": true
}
[
["1","2"],
["3","4"]
]
a
","
"$$csvparse:$"
[{ "a": "," }]
a
""""
"$$csvparse:$"
[{ "a": "\"" }]
1,2
3,4
"$$csvparse(true):$"
[
["1","2"],
["3","4"]
]