Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

CFSPREADSHEET Read truncating empty columns with excludeHeaderRow = true

Explorer ,
Aug 15, 2011 Aug 15, 2011

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 :

NoFruitDescription
1Apple
2Orange

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

1.2K
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Valorous Hero ,
Aug 15, 2011 Aug 15, 2011

Specify the column numbers you want to retrieve explicitly

[ CFSPREADSHEET columns="1-2" .... ]

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Aug 15, 2011 Aug 15, 2011

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.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Valorous Hero ,
Aug 15, 2011 Aug 15, 2011

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==-

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Aug 15, 2011 Aug 15, 2011
LATEST

Ha! Thanks! I completely missed that from the docs thinking columnnames is the name of the columns I want extracted. anyhow, thankyou very much.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Resources