Adds multiple rows from a query or array to an Excel spreadsheet object.

spreadsheetAddRows(spreadsheetObj, data,[ row, column , insert, datatype, includeColumnNames]) → returns void

Argument Reference for the spreadsheetAddRows function


Required: Yes
The spreadsheet object variable


Required: Yes
A query or array


Required: No
The row number in the spreadsheet at which to insert the data. If omitted rows are appended.


Required: No
The column number to start, all columns to the left will be empty.


Required: No
Default: true
When true appends the row data to the spreadsheetObj. When false attempts to update the spreadsheet object rows.


Required: No
CF 11+ An array of datatype expressions with values STRING NUMERIC or DATE. For example use `DATE:1;NUMERIC:2-2;STRING


Required: No
Default: false
CF 2016+ When true writes column names as headers in the spreadsheet.

Examples sample code invoking the spreadsheetAddRows function

Adding rows to a spreadsheet from a Query

<cfset q = queryNew("name,beers",
    [ {"name":"John","beers":2}, {"name":"Pete","beers":1} ])> 

<!--- Make a spreadsheet object ---> 
<cfset s = spreadsheetNew()> 
<!--- Add header row ---> 
<cfset spreadsheetAddRow(s, "Name,Beers")> 
<!--- Add query ---> 
<cfset spreadsheetAddRows(s, q)> 
<cfdump var="#s#" />

Fork me on GitHub