Posted 10 February 2023, 7:33 am EST
Hi Pedro,
In the latest version of SpreadJS, v16, several new methods were added to the Workbook class through the @grapecity/spread-sheets-io package. These methods include save(), open(), import(), and export(), which provide various capabilities for working with spreadsheets. The save() and open() methods allow users to save and load spreadsheets in the sjs format, which has improved performance for larger files. Meanwhile, the import() and export() methods enable users to import and export spreadsheets in formats such as Excel, ssjson, and csv.
It’s important to note that these methods only load the specified file type onto a workbook instance, they do not merge two spreadsheets. To merge two spreadsheets, you would need to merge their respective json files and then load the merged json onto a workbook instance.
For your convenience, a sample code has been provided which demonstrates how to merge an imported sjs file with the current spreadsheet. The sample does this by loading the imported sjs file onto a second (hidden) spreadsheet, obtaining its json using the spread.toJSON() method, and finally merging the json of the two spreadsheets before loading the merged data onto the first spreadsheet.
Sample: https://codesandbox.io/s/solution-forked-zzduhm?file=/src/index.js
Of course! If you continue to encounter any issues, please don’t hesitate to let me know. I’ll do my best to assist you.
Regards,
Ankit