CF 2021- Excel .xlsx NO LONGER Autocalculates
VERY IMPORTANT: This code ran flawlessly on CF v10 (same master excel file "xlsx")
MUST Find solution.
My Master excel is "xlsx". Going back to "xls" is NOT option as we're using advanced features not backward compatible.
To simulate workflow I used Excel to create a blank "xls" and "xlsx" both with "sheet1" renamed to "interview".
The following code sets the cells correctly... BUT "xls" will autocalc when opened, "xlsx" WILL NOT. User must hit [cntrl-alt-F9] which then updates.
Please try yourself, you will see same results.
(simply switch lines 1/2 to use different "master" in your simulation.
<cfset excelFileToUse = "d:\oldExcel.xls">
<cfset excelFileToUse = "d:\testMaster.xlsx">
<cfset dummyNumber = randrange(12345,99999)>
<cfset fileExt = listLast(excelFileToUse,".")>
<cfset CompanyLink = "HYPERLINK(""http://localhost/customers/customer.cfm?customerID=156"",""My Company"")">
<cfset contactLink = "HYPERLINK(""http://localhost//customers/customer.cfm?customerID=156"",""Johnny Walker"")">
<cfset quoteLink = "HYPERLINK(""http://localhost/quotes/oldquote.cfm?quoteID=15263"",""15626"")">
<!--- Read QUOTE Sheet --->
<cfset SpreadsheetObj = SpreadSheetRead(excelFileToUse)>
<cfset SpreadsheetSetActiveSheet(SpreadsheetObj, "interview")>
<!--- hard coded param rather than CF variable, NO DIFFERENCE in outcome --->
<cfset SpreadsheetSetCellFormula(SpreadsheetObj, 'HYPERLINK("http://localhost/customers/customer.cfm?customerID=156","My Company")', 1,2)>
<cfset SpreadsheetSetCellFormula(SpreadsheetObj, contactLink, 2,2)>
<cfset SpreadsheetSetCellFormula(SpreadsheetObj, quoteLink, 3,2)>
<!--- Basic math test --->
<cfset SpreadsheetSetCellFormula(SpreadsheetObj, '134+442', 1,3)>
<cfset SpreadsheetSetCellFormula(SpreadsheetObj, "154*342", 2,3)>
<cfset SpreadsheetSetCellFormula(SpreadsheetObj, "14/62", 3,3)>
<cfset SpreadsheetSetColumnWidth(SpreadsheetObj, 2, 24)>
<cfset SpreadsheetSetColumnWidth(SpreadsheetObj, 3, 24)>
<!--- set active sheet again in effort to troubleshoot, no difference if this line is in code or not --->
<cfset SpreadsheetSetActiveSheet(SpreadsheetObj, "interview")>
<cfset spreadsheetwrite(SpreadsheetObj, "d:\temp\#dummyNumber #.#fileExt#")>
This is my xlsx file upon opening....
NOTE: cells DO have formula and will calculate corrrectly using [cntl-alt-F9]

my "xls" file upon opening

Altready tried adding this to test code.
<cfset obj=SpreadsheetObj.getWorkBook()>
<cfset obj.getCreationHelper().createFormulaEvaluator().evaluateAll()>
This DID solve problem on this simple excel file. However it does not work on actual file as we have lots of formulas and sheet lookups.
SOMEBODY PLEASE HELP
