Skip to main content

CSV

The built-in CSV data provider opens delimited text files as tables. Files are parsed in the browser with PapaParse, in its worker mode; a remote file is parsed while it downloads.

Data source​

CSV data sources have the type "csv" and accept the following fields:

FieldTypeDescription
typestringAlways "csv".
sourcestringURL or path of the CSV file (see Referencing data).
columnsstring[]Names of the columns, for files without a header row. Defaults to the first row of the file.
idColumnstringColumn holding the ID of each row (see Data model). Defaults to row numbers.
nameColumnstringColumn holding the name of each row.
loadColumnsstring[]Columns to load. Defaults to all columns.
parseConfigobjectPapaParse options: delimiter (defaults to ","), newline, quoteChar, escapeChar, preview, comments, fastMode, skipFirstNLines, encoding, and for remote files downloadRequestHeaders, downloadRequestBody and withCredentials.

Empty lines are skipped.

Column types​

A column whose cells all hold numbers is read as 32-bit floats, with blank cells as NaN. Any other cell makes the column a string column. The idColumn is read as integers if every cell holds one, and as strings otherwise; a blank ID fails the load.

Limitations​

  • The loaded columns are held in memory; use loadColumns to leave out the columns a project does not use.

API​

The data provider is implemented in the @tissuumaps/storage package as CSVTableDataProvider. Parsing is delegated to PapaParse (see Dependencies).