Skip to main content

Function: readCsv()

readCsv(text, options?): CsvRead

Defined in: packages/agentos/src/cognition/library/readers/csv.ts:166

Reads a CSV or TSV text into one Markdown table. A byte order mark at the start is dropped, and so is Excel's first line of sep= and a separator, which names the separator unless the options do. A row whose every cell is empty (a blank line among them) is skipped, a short row is filled with empty cells, and the columns after the last that holds a word are left out. A cell is read as one line: a line break inside a quoted cell, with the spaces beside it, is made one space, a bar is made a slash, and the cell's ends are trimmed.

Parameters​

text​

string

The file's text.

options?​

ReadCsvOptions

The separator and the bounds.

Returns​

CsvRead

Throws​

RangeError for a separator other than a comma, a semicolon or a tab, and for a bound below 0, NaN or no number at all.