ExcelScript.CalculationMode enum

Remarks

Examples

/**
 * This script recalculates the used range of a specific worksheet.
 */
function main(workbook: ExcelScript.Workbook) {
  // Only recalculate if the calculation mode is not set to automatic.
  if (workbook.getApplication().getCalculationMode() !== ExcelScript.CalculationMode.automatic) {
    // Get the used range from a worksheet named "Monthly Report".
    const sheet = workbook.getWorksheet("Monthly Report");
    const range = sheet.getUsedRange();
    console.log(`Calculating ${range.getAddress()}`);

    // Force all the used cells in that worksheet to calculate.
    sheet.getUsedRange().calculate();
  }
}

Fields

automatic

The default recalculation behavior where Excel calculates new formula results every time the relevant data is changed.

automaticExceptTables

Calculates new formula results every time the relevant data is changed, unless the formula is in a data table.

manual

Calculations only occur when the user or add-in requests them.