-
-
Notifications
You must be signed in to change notification settings - Fork 40
csvToQuery
Julian Halliwell edited this page May 8, 2017
·
14 revisions
Return a CFML query object from CSV data (either a string or a file containing CSV data).
csvToQuery( csv, filepath[, firstRowIsHeader[, trim[, delimiter ] ] ] )
-
csvstring: the data in CSV format OR -
filepathstring: full file system path of a file containing CSV data
-
firstRowIsHeaderboolean default=false: whether the first line of the CSV contains the column names to use in the query -
trimboolean default=true: whether white space should be removed from the beginning and end of the CSV string (usually desirable to prevent blank rows being added to the end of the query) -
delimiterstring default=",": the single delimiter used in the CSV to separate the fields
spreadsheet = New spreadsheet();
savecontent variable="csv"{
WriteOutput( '
Name,Phone
"Frumpo McNugget",12345
' );
};
data = spreadsheet.csvToQuery( csv=csv, firstRowIsHeader=true );