Spread.Sheets Documentation
Using Cross Sheet References

You can reference other sheets in a formula.

The following image displays the first sheet from the example.

The following image displays the second sheet from the example.

Using Code

This example uses cross-sheet references.

JavaScript
Copy Code

window.onload = function(){
      var spread = new GC.Spread.Sheets.Workbook(document.getElementById("ss"),{sheetCount:3});
      var activeSheet = spread.getActiveSheet();

var sheet1 = spread.getSheet(0),
sheet2 = spread.getSheet(1);

sheet1.name("Sheet1");
sheet2.name("Sheet2");
        
sheet1.setValue(0, 0, 1000);
sheet1.setValue(1, 0, 2000);
sheet1.setValue(2, 0, 3000);
sheet1.setValue(3, 0, 4000);
sheet1.getRange(0, 0, 4, 1).backColor("lightPink");

sheet2.setValue(0, 0, 5000);
sheet2.getRange(0, 0, 1, 1).backColor("lightCyan");
//Set a sum formula of "Sheet1: total of cell(0,0) to cell(3,0)" and "Sheet2: cell(0,0)".
sheet2.setFormula(1, 1, "SUM(Sheet1!A1:A4) + Sheet2!A1");
sheet2.getRange(1, 1, 1, 1).backColor("lemonChiffon");
                      }

See Also

Developer's Guide

Formula Reference

 

 


Copyright © GrapeCity, inc. All rights reserved.

Send comments on this topic.