Skip to content

api/csv Functions

Functions exported from src/api/csv.ts

csvToSheet

function csvToSheet(text: string, opts?: { FS?: string }): WorkSheet

Parameters

NameTypeDescription
textstringCSV text to parse
opts (optional){ FS?: string }Optional: { FS: field separator (default ",") }

Returns

WorkSheet

A WorkSheet with the parsed data


sheetToCsv

function sheetToCsv(sheet: WorkSheet, opts?: Sheet2CSVOpts): string

Parameters

NameTypeDescription
sheetWorkSheetThe worksheet to convert
opts (optional)Sheet2CSVOptsOptional CSV generation options (FS, RS, skipHidden, strip, blankrows, rawNumbers, forceQuotes)

Returns

string

The CSV string representation of the worksheet


sheetToTxt

function sheetToTxt(sheet: WorkSheet, opts?: Sheet2CSVOpts): string

Parameters

NameTypeDescription
sheetWorkSheetThe worksheet to convert
opts (optional)Sheet2CSVOptsOptional CSV/TSV generation options (same as sheetToCsv)

Returns

string

The TSV string representation of the worksheet