$$csvparse
Converts a CSV string into an array of objects/arrays
Usage​
{
"$$csvparse": /* csv contents */,
"no_headers": false /* boolean */,
"separator": "," /* string */,
"names": /* array */
}
"$$csvparse([no_headers],[separator],[names]):{input}"
note
Concrete values in the usage example are default values.
Returns​
object[]
Arguments​
Argument | Type | Values | Required / Default Value | Description |
---|---|---|---|---|
Primary | string | Yes | csv contents | |
no_headers | boolean | false /true | false | Whether to treat the first row as object keys |
separator | string | "," | Use an alternative field separator | |
names | array | null | 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(true):$"
[
[
"1",
"2"
],
[
"3",
"4"
]
]
a
","
{
"$$csvparse": "$"
}
[
{
"a": ","
}
]
a
""""
{
"$$csvparse": "$"
}
[
{
"a": "\""
}
]
1,2
3,4
{
"$$csvparse": "$",
"no_headers": true
}
[
[
"1",
"2"
],
[
"3",
"4"
]
]