Copy link to clipboard
Copied
Hi,
Is anyone having an issue with ExcludeHeaderRow for CFSPREADSHEET where it is truncating an entire column if the column is empty, even though it has a header column?
Below is my code to read an excel file named Fruits.XLS:
<CFSPREADSHEET ACTION="READ" SRC="c:\Fruits.XLS" QUERY="q_xls" SHEETNAME="Sheet1" headerrow="1" excludeheaderrow="true"></cfspreadsheet>
<cfdump var="#q_xls#">
Fruits.XLS consists of :
No | Fruit | Description |
---|---|---|
1 | Apple | |
2 | Orange |
Coldfusion's returned query 'q_xls' is as below, with the Description column missing:
No Fruit
1 Apple
2 Orange
This is an issue because the returned query is expected to contain column "Description" with empty values, but it does not exist.I know there are workarounds like, not setting ExcludeHeaderRow to true, but I'd rather not go there.
Please help.
Version : CF 9.0.1
Thanks
Lisa
Copy link to clipboard
Copied
Specify the column numbers you want to retrieve explicitly
[ CFSPREADSHEET columns="1-2" .... ]
Copy link to clipboard
Copied
Forgot to mention that I have the columnnames specified - <CFSPREADSHEET ... columnnames="No,Fruit,Description"> but that did not work - "Description" column in returned query is still missing.
Specifying columns="1-3" works so I'd expect columnnames to work but it doesn't.
Is this a bug?
Thank you.
Copy link to clipboard
Copied
No, it is not a bug. "columnames" refers to the query not the headers in your spreadsheet. The purpose of that attribute is to let you define/change the column names in the resulting query ie "q_xls".
Message was edited by: -==cfSearching==-
Copy link to clipboard
Copied
Ha! Thanks! I completely missed that from the docs thinking columnnames is the name of the columns I want extracted. anyhow, thankyou very much.