Writes a list of rows, each a list of cells, as CSV text; a cell holding a separator, a quote or a line break is wrapped in double quotes.
Example: [["name", "age"], ["John", "30"]] -> name,age and John,30 on two lines.
The rows and the two separators
The CSV text
Writes a list of objects as CSV text with the columns you name in headers, in that order; a
property an object lacks becomes an empty cell.
With includeHeaders true the first line holds the header names. Example: [{ name: "John", age: "30" }] with headers ["name", "age"] -> name,age and John,30.
The objects, the column names, the header flag and the separators
The CSV text
Writes a list of objects as CSV text using the property names of the first object as the columns, in their order; an empty list gives empty text.
Example: [{ name: "John", age: "30" }] -> name,age and John,30.
The objects, the header flag and the separators
The CSV text
Splits CSV text into a list of rows, each a list of cell strings; nothing is converted to numbers.
Blank lines are skipped, cells are trimmed with their line, and a double-quoted cell may
contain the separator and doubled quotes. Example: a,b,c and 1,2,3 on two lines ->
[["a", "b", "c"], ["1", "2", "3"]].
The CSV text and the two separators
The rows as lists of cell strings
Turns CSV text into a list of objects, one per data row, keyed by the header names of row
headerRow.
Rows start at dataStartRow, columns named in numberColumns become numbers and a missing
cell becomes an empty string. Example: name,age then John,30 -> [{ name: "John", age: "30" }].
The CSV text, the header and data row indexes, the separators and the number columns
One object per data row
Turns CSV text into a list of objects keyed by the headers you give, for files without a
header line; a header line the file does have is skipped by setting dataStartRow past it.
Columns named in numberColumns become numbers. Example: John,30 with headers ["name", "age"] -> [{ name: "John", age: "30" }].
The CSV text, the header names, the data start row, the separators and the number columns
One object per data row
Lists every value of one column, found by its header name, in row order; a row without that cell gives an empty string.
With asNumber true the values are parsed as numbers. Example: name,age then John,30 and
Jane,25, column name -> ["John", "Jane"].
The CSV text, the column name, the header and data row indexes, the separators and the number flag
The column's values, top to bottom
Keeps only the rows whose cell in column equals value, giving them as objects keyed by
the headers.
The comparison is on text unless the column is listed in numberColumns, in which case both
sides are compared as numbers. Example: column age, value 30 -> [{ name: "John", age: "30" }].
The CSV text, the column name, the value, the row indexes, the separators and the number columns
The matching rows as objects
Reads the cells of row headerRow as the header names; a row index past the end throws an
error.
Example: name,age then John,30 -> ["name", "age"].
The CSV text, the header row index and the separators
The header names in column order
Counts the data rows: all non-blank lines minus the ones before dataStartRow, or minus one
header line when hasHeaders is true and dataStartRow is left out.
Example: name,age, John,30, Jane,25 with headers -> 2.
The CSV text, the header flag, the optional data start row and the separators
The number of data rows
Counts the cells of the first non-blank row, which is the number of columns; empty text gives 0.
Example: name,age,city then John,30,NYC -> 3.
The CSV text and the two separators
The number of columns
Reading and writing CSV, the plain-text table format with one row per line and a separator between cells. The parsers split on
rowSeparatorandcolumnSeparator, honor double-quoted cells with doubled quotes inside, skip blank lines and read\n,\tand\rwritten as two characters as the real thing; the writers quote a cell that contains a separator, a quote or a line break.