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

Write a spreadsheet object to a CSV file.

writeToCsv( workbook, filepath [, overwrite [, delimiter, [ includeHeaderRow, [ headerRow ] ] ] ] )

Required arguments

  • workbook spreadsheet object
  • filepath string: the absolute path of the CSV file to be written.

Optional arguments

  • overwrite boolean default=false: whether to overwrite an existing file
  • 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 )#.
  • includeHeaderRow boolean default=true: whether to include the sheet header row in the CSV.
  • headerRow numeric default=1: the sheet's header row

Chainable? Yes.

Examples

data = QueryNew( "First,Last", "VarChar,VarChar", [ [ "Susi","Sorglos" ], [ "Frumpo","McNugget" ] ] );
spreadsheet = New spreadsheet();
workbook = spreadsheet.workbookFromQuery( data );
path = "C:/temp/test.csv";
spreadsheet.writeToCsv( workbook, path );
Clone this wiki locally