downloadCsvFromFile - cfsimplicity/spreadsheet-cfml GitHub Wiki
Provides a quick way of downloading a CSV file generated from an Excel spreadsheet file.
downloadCsvFromFile( src, filename[, columns [, columnNames [, headerRow [, rows [, sheetName [, includeHeaderRow [, includeBlankRows [, fillMergedCellsWithVisibleValue [, includeHiddenColumns [, delimiter ] ] ] ] ] ] ] ] ] ] )
or
downloadCsvFromFile( src, filename, [columns [, columnNames [, headerRow [, rows [, sheetNumber [, includeHeaderRow [, includeBlankRows [, fillMergedCellsWithVisibleValue [, includeHiddenColumns [, delimiter ] ] ] ] ] ] ] ] ] ] )
Required arguments
src
string: full path to the file to readfilename
string: name of the file to download, without the file extension
Optional arguments
columns
string: specify the columns you want to read as a comma-delimited list of ranges. Each value can be either a single number or a range of numbers with a hyphen, e.g. "1,2-5"columnNames
string: a comma-delimited list of the names to use for the query columns in the order the columns appear in the spreadsheet. If you specify fewer names than the total number of columns, the remaining column names will be in the form columnX. Note that specifyingcolumnNames
overrides use of aheaderRow
for column names.headerRow
numeric: specify which row is the header to be used for the query column namesrows
string: specify the rows you want to read as a comma-delimited list of ranges. Each value can be either a single number or a range of numbers with a hyphen, e.g. "1,2-5"sheetName
string: name of the sheet to read ORsheetNumber
numeric default=1: number of the sheet to read (1 based, not zero-based)includeHeaderRow
boolean default=false: whether to include the header row from the spreadsheet (NB: the default is the opposite to Adobe ColdFusion 9, which isexcludeHeaderRow=false
).includeBlankRows
boolean default=false: whether to include blank rows from the spreadsheet in the query data set. By default blank rows are suppressed.fillMergedCellsWithVisibleValue
boolean default=false: if the source sheet contains merged cells, set the value of each cell in the merged region to the visible value stored in the top/left-most cellincludeHiddenColumns
boolean default=true: if set to false, columns formatted as "hidden" will not be included when reading into a querydelimiter
string default=",": delimiter to use.
Chainable? No.
Example
spreadsheet = New spreadsheet();
filepath = ExpandPath( "report.xls" );
spreadsheet.downloadCsvFromFile( filepath,filename );