Where did the user edits go

Posted by: gerry.haustein on 15 October 2020, 8:53 am EST

  • Posted 15 October 2020, 8:53 am EST

    I followed the tutorial here: https://www.grapecity.com/blogs/how-to-importexport-excel-files-using-javascript-and-spread-sheets

    To load a excel file into a div. Part of the example creates a workbook
    var workbook = new GC.Spread.Sheets.Workbook(document.getElementById("ss")); 


    But when the user edits the in-browser spreadsheet "workbook" does not get updated to reflect the changes.

    How to enable MVC type behavior?
  • Replied 16 October 2020, 12:43 am EST

    Hi Gerry,

    If I understand correctly you expecting to change the original file while any changes happened on the sheet but we are sorry it is a technical limitation. Web apps do not have access to the local files system for security reasons. So when the user edits on the sheet the Changes stay on the sheet until you export it. You may export back to the excel file. Please refer to the following references which show how you could import or export the excel file and let us know if you face any issues.

    import/export Demo: https://www.grapecity.com/spreadjs/demos/features/workbook/excel-import-export/purejs

    Regards
    Avinash
  • Replied 16 October 2020, 1:59 am EST

    Don't be silly.

  • Replied 16 October 2020, 2:04 am EST

    Oops, turns out I was re-using the json data from
     this.excelIO.open(assetfile, function (json) {
    that.workbook.fromJSON(json);
    that.jsonsheets = json.sheets;

    and forgot to reload it with
    this.jsonsheets = this.workbook.toJSON({ includeBindingSource: true });

    before checking it for user changes
  • Marked as Answer

    Replied 18 October 2020, 4:46 pm EST

    Hi Gerry,

    We are glad that you were able to resolve the issue. Feel free to reach out if you face any issues.

    Regards
    Avinash
Need extra support?

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

Learn More

Forum Channels