calculateFormula
Versionshinweise | 20.2 |
---|
Code
void calculateFormula(Spreadsheet spreadsheet)
Beschreibung
Es werden alle Formelfelder in der Tabellenkalkulationsdatei neu berechnet.
Parameter
- spreadsheet
Repräsentiert die Tabellenkalkulationsdatei
Beispiele
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