Posted 26 March 2020, 5:20 pm ESThow to export excel data in spreadjs into json file in angular?
spread js in angular
Posted by: preetidubariya on 26 March 2020, 5:20 pm EST
Replied 29 March 2020, 11:30 pm ESTHi,
You may use the toJSON()/fromJSON() methods to serialize/deserialize the SpreadJS workbook to/from JSON. Please refer to the following code snippet:
let wbJSON = spreadInstance.toJSON();
• toJSON() method: https://www.grapecity.com/spreadjs/docs/v13/online/SpreadJS~GC.Spread.Sheets.Workbook~toJSON.html
Replied 30 March 2020, 1:12 am ESTHi ,
toJson method is updating the data to display.but i want to store that data into my json file.how can i achieve that?
Thanks for reply.
Replied 31 March 2020, 12:40 am ESTHi Preeti,
toJSON method is not supposed to update the data. Could you please explain further what is the issue you are facing i.e what data is being updated when using the toJSON method.
Further, you may also refer to the following sample demonstrating the usage of toJSON method in an angular application:
Replied 31 March 2020, 4:44 pm ESTHi Sharad,
whenever any changes in spreadsheet occurs it should update the json data in background in the file from which i am fetching the data to display.
Replied 5 April 2020, 6:05 pm ESTHi Preeti,
In this case, you may handle the various events such as EditEnded, RangeChanged, ClipboardPasted etc. provided by the Spread API and update the data in the background. Further, could you please explain more about your requirement like is the JSON file is a JSON template for SJS or it is just the data needs to be displayed, do you need to update only the values in the JSON file or you need to save the styles info too or any other information you think would be useful in better understanding of the requirement.
events provided by SpreadJS API: https://www.grapecity.com/spreadjs/docs/v13/online/SpreadJS~GC.Spread.Sheets.Events.html