SpreadJS 13
SpreadJS Documentation / Sample Code / Sample Code for Cell References / Evaluate Formula
In This Topic
    Evaluate Formula
    In This Topic

    You can evaluate a formula using the evaluateFormula() method as shown in the code snippet shared below. 

    JavaScript
    Copy Code
    var spread =
    new GC.Spread.Sheets.Workbook(document.getElementById('ss'),
    { sheetCount: 1 });
    sheet = spread.getSheet(0);
    sheet.setValue(0, 0, 1);
    sheet.setValue(1, 0, 2);
    
    // Using EvaluateFormula() method to evaluate formula without setting formula in sheet's cell
    var result =
    GC.Spread.Sheets.CalcEngine.evaluateFormula(sheet, "SUM(A1:A2)", 0, 0);
    console.log("SUM(A1:A2) = " + result);