Spread.Sheets Documentation
Getting Cell Values
Spread.Sheets Documentation > Sample Code > Sample Code for Cells > Getting Cell Values

You can get the values from the cells.

Using Code

This example gets the cell values.

JavaScript
Copy Code

$(document).ready(function () {
    var spread = new GC.Spread.Sheets.Workbook(document.getElementById("ss"),{sheetCount:3});
    var sheet = spread.getActiveSheet();
sheet.getCell(0, 0).formatter("0.00_);(0.00)");
sheet.getCell(1, 0).formatter("0.00_);(0.00)");
sheet.getCell(0, 1).formatter("0.00_);(0.00)");
sheet.getCell(1, 1).formatter("0.00_);(0.00)");

     //Set values to Text property
     sheet.getCell(0, 0).text("10");
     //Set values by calling SetText method
     sheet.setText(1, 0, "10");

     //Set values to Value property.
     sheet.getCell(0, 1).value(10);
     //Set values by calling SetValue method.
     sheet.setValue(1, 1, 10);

     $("#button1").click(function(){
         alert("Obtaining cell values by referring to Text property: " + sheet.getCell(0, 0).text() + "\n" +
             "Obtaining cell values by calling GetText method: " + sheet.getText(1, 0) + "\n" +
             "Obtaining cell values by referring to Value property: " + sheet.getCell(0, 1).value() + "\n" +
             "Obtaining cell values by calling GetValue method: " + sheet.getValue(1, 1));
     });
});