csvExport
Type
command
Summary
Converts a data array into a delimiter separated string
Syntax
csvExport <pArray>,<pOptions>,<rText>
Description
This command takes in an array, converts it into a delimiter separated text based on optional parameters and returns it as a text string.
When specifying the quoting-rule for CSV export, consider the following options:
- "all": Quotes all fields for consistency.
- "minimal": Quotes fields with special characters to ensure data integrity.
- "none": Does not quote any fields, potentially increasing readability but may cause issues with special characters.
Parameters
Name | Type | Description |
---|---|---|
pArray | Input nested data array with format { "headers": [ col1header, col2header,...], "data": [ [row1col1data, row1col2data, ...], [row2col1data, row2col2data, ...] ] } | |
pOptions | An array of options to use when handling csv. The keys are as follows:
| |
rText | Returns a delimiter separated text form of the input data array |
Examples
local tArray
put { \
"headers":["ID","Name"], \
"data": [ \
["1","John"], \
["2","Doe"] \
] \
} \
into tArray
local tOptions
put { "has-header-row": true } into tOptions
local tText
csvExport \
tArray, \
tOptions, \
tText