spreadsheetAddRows

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

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

spreadsheetAddRows Argument Reference

spreadsheetObj
Required

The spreadsheet object variable

data
Required

A query or array

row

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

column

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

insert
Default: true

When true appends the row data to the spreadsheetObj. When false attempts to update the spreadsheet object rows.

datatype

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

includeColumnNames
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",
    "varchar,integer",
    [ {"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