Search code examples
coldfusioncfspreadsheet

cfspreadsheet Parameter validation error


I am trying to get a basic example to work using cfspreadsheet. But this is the error I am receiving:

Parameter validation error for the SPREADSHEETSETCELLVALUE function.

Code

<cfset objSpreadsheet = SpreadsheetNew()>

<!--- Create and format the header row. --->
<cfset SpreadsheetAddRow( objSpreadsheet, "Location,Percent of Total Checklists,Location Total" )>
<cfset SpreadsheetFormatRow( objSpreadsheet, {bold=true, alignment="center"}, 1 )>

<!--- Populate the spreadsheet. --->
<cfset SpreadsheetSetCellValue( objSpreadsheet, 'FSC', 2, 1, "String" ) >
<cfset SpreadsheetSetCellValue( objSpreadsheet, .03, 2, 2, "Numeric" ) >
<cfset SpreadsheetSetCellValue( objSpreadsheet, 13, 2, 3, "Numeric" ) >
<cfset SpreadsheetSetCellValue( objSpreadsheet, 'OPERATIONS', 3, 1, "String" ) >
<cfset SpreadsheetSetCellValue( objSpreadsheet, 13.78, 3, 2, "Numeric" ) >
<cfset SpreadsheetSetCellValue( objSpreadsheet, 5161, 3, 3, "Numeric" ) >


<cfheader name="Content-Disposition" value="attachment; filename=LS_#Dateformat(NOW(),'MMDDYYYY')#"> 
<cfcontent type="application/vnd.ms-excel" variable="#SpreadsheetReadBinary( objSpreadsheet )#"> 

Any help with this would be greatly appreciated.


Solution

  • The datatype (String, Numeric) argument wasn't added until CF11, and is refrenced in the adobe docs under history. If you try to include the data type in CF9 and CF10 you will get the validation error.

    You can see your example working on TryCF.com in CF11.