excel - ColdFusion CFSpreadsheet reads empty cells -


i give client template supposed populate , upload spreadsheet , read file cfspreadsheet in order copy data database table.

pretty easy. template has 1 column in it. client can not upload sheet more 1 column in it. used work.

so 1 column header ing_cas when read file in cfspreadsheet col_2, col_3, ing_cas. not blank cells getting read being given default names because of attribute headerrow="1".

i'm @ loss here. keep downloading template , selecting extraneous blank rows , columns , deleting them have no control on file once client gets it.

is there strange setting missing make cfspreadsheet ignore blank cells?

<cfspreadsheet action="read" src="#thefile#" query="spreadsheetdata" headerrow="1"> <cfdump var="#spreadsheetdata#" /> 

i ended writing helper function stripped out col_(n) columns.

<cffunction name="cleanexcelquery" access="public" returntype="query" output="false" hint="strips out blank column headers picked on read.">     <cfargument name="spreadsheetquery" type="query" required="true" />      <cfset var thecolumnheaders = spreadsheetquery.columnlist>     <cfset var thenewcolumnheaders = "">      <cfloop list="#thecolumnheaders#" index="h">         <cfif ucase(left(h,  4)) not "col_">             <cfset thenewcolumnheaders = listappend( thenewcolumnheaders,  h )>         </cfif>     </cfloop>      <cfquery name="newspreadsheetquery" dbtype="query">         select #thenewcolumnheaders#         spreadsheetquery     </cfquery>      <cfreturn newspreadsheetquery /> </cffunction> 

cfspreadsheet omits cells completely blank: no value or format (such when select cell , use "clear all"). if picking "extra" columns, because 1 or more of cells in column have value or custom cell format. meaning not "blank".

if know column position, can use columns attribute only read values in column. example, read column c:

   <cfspreadsheet action="read"             src="c:/path/to/file.xls"             columns="3"             headerrow="1"             query="qresult" /> 

but not sure understand why issue. if need 1 column, ignore other columns in code. can elaborate on why causing issue?


Comments

Popular posts from this blog

linux - Does gcc have any options to add version info in ELF binary file? -

android - send complex objects as post php java -

charts - What graph/dashboard product is facebook using in Dashboard: PUE & WUE -