I'm writing query results to an excel spreadsheet using cfspreadsheet (in ColdFusion). The customer does not want the header rows showing up on the excel sheet. The excludeheaderrow attribute is only for reading. Does anyone know if it's possible to NOT write the header rows to the spreadsheet?
Thanks!
spreadSheetAddRows
and spreadSheetWrite
will create the spreadsheet without the column headers.
This bellow snippet will write a .xls file that has just the values 1,2,3 in row 1. The last 3 lines in the cfscript block can be used in place of: <cfspreadsheet action="write" query="qTest" filename="temp.xls">
. Additional attributes and function will be required if you have additional attributes in your cfspreasheet
tag.
<cfscript>
qTest = queryNew("Column1,Column2,Column3");
queryaddRow(qTest);
querySetCell(qTest ,"Column1",1);
querySetCell(qTest ,"Column2",2);
querySetCell(qTest ,"Column3",3);
spreadSheetObj= spreadsheetNew(false); //true for xlsx format
spreadsheetAddRows(spreadSheetObj,qTest);
spreadSheetWrite(spreadSheetObj,expandPath("./") &"temp.xls");
</cfscript>