Skip to main content
Skip table of contents

calculateFormula

Versionshinweise

20.2

Code

CODE
void calculateFormula(Spreadsheet spreadsheet)

Beschreibung

Es werden alle Formelfelder in der Tabellenkalkulationsdatei neu berechnet. 

Parameter

  • spreadsheet
    Repräsentiert die Tabellenkalkulationsdatei

Beispiele

CODE
ISpreadsheetResultOpen openResult = SpreadsheetUtils.createFile(); 
 
if (!openResult.isSuccessful())
{
    ScriptUtils.debug("Error: " + openResult.getFileName()  + " - " + openResult.getErrorCode());
    /** do furthermore */
    return;
}
 
Spreadsheet excel = openResult.getSpreadsheet();
SpreadsheetUtils.setValue(excel, "A1", 2);
SpreadsheetUtils.setValue(excel, "A2", 3);
SpreadsheetUtils.setFormula(excel, "A3", "=SUM(A1:A2)");
SpreadsheetUtils.calculateFormula(excel);
Object value = SpreadsheetUtils.getValue(excel, "A3");
// do something with value, of course its value is 5
JavaScript errors detected

Please note, these errors can depend on your browser setup.

If this problem persists, please contact our support.