CSV support for the data macro in
Quaint.
quaint --setup csv
format table ::
data csv ::
Name,Job
Alice,accountant
Bob,baker
Importing from a file:
rows => data :: jobs.csv
each {rows} row ::
* {row.Name}'s job is {row.Job}
;; output:
;; * Alice's job is accountant
;; * Bob's job is baker
This configuration entry must be added in the plugins section of
quaint.json:
"csv": {
"recordSeparator": "\n",
"fieldSeparator": ",",
"quote": "\"",
"trim": false,
"useHeader": true
}The file extension to use for the CSV files. (default: "csv")
The separator character for records (default: \n)
The separator character for fields (default: ,)
The character used for quoting (default: ")
Whether to trim field values. (default: false)
Whether to use the first line as field names or not. (default: true)
If this is true, then the result is an array of records with the names taken from the first line of the file, otherwise it will be an array of arrays.