SpreadJS: Where is the data stored?

Posted by: nuno-nogueira on 8 September 2017, 9:42 am EST

  • Posted 8 September 2017, 9:42 am EST

    Hi,

    I’m looking for a solution to create online spreadsheets. Looking at your SpreadJS app documentation, I couldn’t find out where the data is stored (in the server or locally)?

    Also, is it possible to manipulate the data in the spreadsheet programatically (using PHP or JavaScript)? I need to loop through ranges of cells, perform calculations, change the data in certain cells, etc, just like VBA code in Excel.

    Thanks in advance for your support!

  • Posted 8 September 2017, 9:42 am EST

    Hi,

    The data in SpreadJS is stored locally unless you’ve implemented saving and retrieving of data from the server.

    To loop through the cells, you can use the $.wijmo.wijspread.Sheet.getCells() method and get the value of each cell using the getValue() method as below :

    [js]var spread = $(“#spreadContainer”).wijspread(“spread”);

    var sheet = spread.getActiveSheet();

    var cells = sheet.getCells(5, 3, 7, 6);

    var values;

    for (var i = cells.row; i < cells.row2; i++) {

    for (var j = cells.col; j < cells.col2; j++) {

    values = values + sheet.getValue(i, j) + ",";

    }

    }[/js]

    You can then perform calculations on the retrieved values.

    To change the data in certain cells, you can use the setValue() method as below :

    [js]var spread = $("#spreadContainer").wijspread("spread");

    var sheet = spread.getActiveSheet();

    var total = sheet.getValue(1, 1) + sheet.getValue(2, 1) + sheet.getValue(3, 1);

    sheet.setValue(4, 0, "total");

    sheet.setValue(4, 1, total);[/js]

    Hope it helps

    Regards

    Abdias

  • Posted 8 September 2017, 9:42 am EST

    Hi,

    Perhaps I could implement some kind of file save/open using Firebase or something similar. Do you think that would work?

    Saving a spreadsheet table data to the browser cookies doesn’t seem very functional. The data is lost every time you refresh the browser, preventing users from saving their work or even multiple working files like they normally do with Excel.

    Thanks for your help, this seems like a high potentital tool!

    Regards,

    Nuno

  • Posted 8 September 2017, 9:42 am EST

    Hi,

    Can you describe the method to import/export the data in SpreadJS to the server?

    The documentation isn’t clear about this.

  • Posted 8 September 2017, 9:42 am EST

    Hi Nuno,

    Please take a look at this demo where data is loaded from a file saved on the server using fromJSON method of SpreadJS.

    Regards

    Abdias

  • Posted 8 September 2017, 9:42 am EST

    Hi,

    Thanks, it makes more sense now.

    Could you indicate where the file pages/monthprofit_json.txt is or attach a copy? That would help.

    Regards,

    Nuno

  • Posted 8 September 2017, 9:42 am EST

    Hi Nuno,

    Sorry for the delay in response. The monthprofit_json.txt comes along with the SpreadJS demo. You can download the Wijmo Enterprise suite from http://wijmo.com/downloads/.

    Once you extract it, you can find the file at the location mentioned below :

    Wijmo-Enterprise.3.20132.8SpreadJS-1.20132.3samplespages

    Regards

    Abdias

  • Posted 2 October 2018, 2:45 pm EST

    Can this thread be updated with a working link for the CRUD demo that Abdias posted (three posts above this post)? Or any relevant CRUD examples in a demo? There’s no hint of how one might go about this in any of the documentation for SpreadJS spread.sheets.

    For example, just trying to do a put request, I need to dynamically build the values of all the cells in one row and send it w/ JSON, but I don’t know what SpreadJS methods would be useful for this.

  • Posted 2 October 2018, 2:45 pm EST

    Can this thread be updated with a working link for the CRUD demo that Abdias posted (three posts above this post)? Or any relevant CRUD examples in a demo? There’s no hint of how one might go about this in any of the documentation for SpreadJS spread.sheets.

    For example, just trying to do a put request, I need to dynamically build the values of all the cells in one row and send it w/ JSON, but I don’t know what SpreadJS methods would be useful for this.

Need extra support?

Upgrade your support plan and get personal unlimited phone support with our customer engagement team

Learn More

Forum Channels