Skip to content
Julian Halliwell edited this page Sep 20, 2021 · 7 revisions

Returns a workbook object from a csv string or a file containing one.

workbookFromCsv( csv, filepath[, firstRowIsHeader[, boldHeaderRow[, trim [, xmlFormat[, delimiter ] ] ] ] ] )

Required arguments

  • csv string: the data in CSV format OR
  • filepath string: full filesystem path of a file containing CSV data

Optional arguments

  • firstRowIsHeader boolean default=false: whether the first line of the CSV contains the column names to use in the query
  • boldHeaderRow boolean default=true: whether to make the header row bold
  • trim boolean default=true: whether white space should be removed from the beginning and end of the CSV string
  • xmlformat boolean default=false: whether to create an XML spreadsheet (.xlsx)
  • delimiter string default=",": the single delimiter used in the CSV to separate the fields. For tab delimited data, use \t or tab or #Chr( 9 )#.

Chainable? Yes, using spreadsheet.newChainable().fromCsv().

Example

spreadsheet = New spreadsheet();
savecontent variable="csv"{
  WriteOutput( '
Name,Phone
"Frumpo McNugget",12345
' );
};
spreadsheetObject = spreadsheet.workbookFromCsv( csv=csv, firstRowIsHeader=true );
Clone this wiki locally