workbookFromCsv - cfsimplicity/spreadsheet-cfml GitHub Wiki
Returns a workbook object from a csv string or a file containing one.
workbookFromCsv( csv, filepath[, firstRowIsHeader[, boldHeaderRow[, trim [, xmlFormat[, delimiter ] ] ] ] ] )
Required arguments
csvstring: the data in CSV format ORfilepathstring: full filesystem path of a file containing CSV data
Optional arguments
firstRowIsHeaderboolean default=false: whether the first line of the CSV contains the column names to use in the queryboldHeaderRowboolean default=true: whether to make the header row boldtrimboolean default=true: whether white space should be removed from the beginning and end of the CSV stringxmlformatboolean default=false: whether to create an XML spreadsheet (.xlsx)delimiterstring default=",": the single delimiter used in the CSV to separate the fields. For tab delimited data, use\tortabor#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 );