spreadsheetGetForceFormulaRecalculation

Description 

Retrieves information whether an Excel object has formulas that are recalculated when the file opens. 

Returns 

Returns Boolean for the spreadsheet object where formula recalculation is set to true or false. 

History 

  • ColdFusion (2025 release): Added the function. 

Syntax 

spreadsheetGetForceFormulaRecalculation(Object spreadsheet)
spreadsheetGetForceFormulaRecalculation(Object spreadsheet)
spreadsheetGetForceFormulaRecalculation(Object spreadsheet)

Parameters 

 

Name 

Required 

Type 

Description 

spreadSheetObject 

Yes 

ExcelInfo 

The Excel spreadsheet object which contains a formula or formulas to recalculate on launch. 

 

Example

<cfscript>
theFile=GetDirectoryFromPath(GetCurrentTemplatePath()) &"BookFormula.xlsx";
theFile1=GetDirectoryFromPath(GetCurrentTemplatePath()) &"SpreadsheetSetPrintOrientationReadTrue.xlsx";
// read the first xlsx file
obj=SpreadsheetRead(#theFile#)
// set the value 21 to row 3, col 1
SpreadsheetSetCellValue(obj,21, 3, 1)
// add formula on cell row 11, col 1
SpreadsheetSetCellFormula(obj, "SUM(A1:A9)", 11, 1)
// force formula recalculation
SpreadsheetSetForceFormulaRecalculation(obj,true)
value=SpreadsheetGetForceFormulaRecalculation(obj)
writeoutput(value&"<br>")
spreadsheetWrite(obj,#theFile1#,"", "yes", "no")
obj=SpreadsheetRead(#theFile1#)
theValue=SpreadsheetGetCellValue(obj,11,1);
writeoutput(#theValue# &"<br>")
theValue2=SpreadsheetGetCellValue(obj,14,1);
writeoutput(#theValue2#)
</cfscript>
<cfscript> theFile=GetDirectoryFromPath(GetCurrentTemplatePath()) &"BookFormula.xlsx"; theFile1=GetDirectoryFromPath(GetCurrentTemplatePath()) &"SpreadsheetSetPrintOrientationReadTrue.xlsx"; // read the first xlsx file obj=SpreadsheetRead(#theFile#) // set the value 21 to row 3, col 1 SpreadsheetSetCellValue(obj,21, 3, 1) // add formula on cell row 11, col 1 SpreadsheetSetCellFormula(obj, "SUM(A1:A9)", 11, 1) // force formula recalculation SpreadsheetSetForceFormulaRecalculation(obj,true) value=SpreadsheetGetForceFormulaRecalculation(obj) writeoutput(value&"<br>") spreadsheetWrite(obj,#theFile1#,"", "yes", "no") obj=SpreadsheetRead(#theFile1#) theValue=SpreadsheetGetCellValue(obj,11,1); writeoutput(#theValue# &"<br>") theValue2=SpreadsheetGetCellValue(obj,14,1); writeoutput(#theValue2#) </cfscript>
<cfscript>
    theFile=GetDirectoryFromPath(GetCurrentTemplatePath()) &"BookFormula.xlsx";
    theFile1=GetDirectoryFromPath(GetCurrentTemplatePath()) &"SpreadsheetSetPrintOrientationReadTrue.xlsx";
    // read the first xlsx file
    obj=SpreadsheetRead(#theFile#)
    // set the value 21 to row 3, col 1
    SpreadsheetSetCellValue(obj,21, 3, 1)
    // add formula on cell row 11, col 1
    SpreadsheetSetCellFormula(obj, "SUM(A1:A9)", 11, 1)
    // force formula recalculation
    SpreadsheetSetForceFormulaRecalculation(obj,true)
    value=SpreadsheetGetForceFormulaRecalculation(obj)
    writeoutput(value&"<br>")
    spreadsheetWrite(obj,#theFile1#,"", "yes", "no")
    obj=SpreadsheetRead(#theFile1#)
    theValue=SpreadsheetGetCellValue(obj,11,1);
    writeoutput(#theValue# &"<br>")
    theValue2=SpreadsheetGetCellValue(obj,14,1);
    writeoutput(#theValue2#)
</cfscript>

Get help faster and easier

New user?