I'm using CF 9 to try and create a spreadsheet from a template. The spreadsheet has 2 sheets, 1 that has charts on it, 2 contains the data used to create the charts.
The data for sheet 2 is stored in MS SQL database and I'm querying that and trying to write to the second sheet that contains the formulas to have the charts auto-generated. I'm getting the following error message when I try to update the sheet that contains the data that I wrote to sheet 2. The updates work for sheet 1 but when I try to update sheet 2 I get the error. An exception occurred while using action=update. java.lang.IllegalArgumentException: The workbook already contains a sheet of this name Here is the code (I simplified the loop to try for testing/dev): <cfspreadsheet action="read" src="#application.rootDir#assets\C3d\IgG_Single_Template.xlsm" name="Patient_Output" sheet="1"> <cfspreadsheet action="read" src="#application.rootDir#assets\C3d\IgG_Single_Template.xlsm" name="newCalc_P1" sheet="2"> <cfset SpreadsheetSetCellValue(Patient_Output,patientResults.patientName,7,5)> <cfset SpreadsheetSetCellValue(Patient_Output,patientResults.clinic,8,5)> <cfset SpreadsheetSetCellValue(Patient_Output,DateFormat(patientResults.patientDOB,"mm/dd/yyyy"),9,5)> <cfset SpreadsheetSetCellValue(Patient_Output,DateFormat(patientResults.sampleDate,"mm/dd/yyyy"),10,5)> <cfset SpreadsheetSetCellValue(Patient_Output,DateFormat(patientResults.reportDate,"mm/dd/yyyy"),11,5)> <cfset SpreadsheetSetCellValue(Patient_Output,patientResults.doctor,12,5)> <cfset SpreadsheetSetCellValue(Patient_Output,"link goes here",13,3)> <cfloop from="1" to="20" index="i"> <cfset SpreadsheetSetCellValue(newCalc_P1,".5",2,2)> </cfloop> <!--- Write both sheets to the new file. ---> <cfspreadsheet action="write" filename="#theFile#" name="Patient_Output" overwrite="true"> <cfspreadsheet action="update" filename="#theFile#" name="newCalc_P1" sheetname="newCalc_P1"> <!--- Redirect user to the patient spreadsheet. ---> <cflocation url="/C3d/individual_results/#patientResults.lname#.xlsm"> Any help would be greatly appreciated. Thanks in advance, Jeff