Posted 30 October 2025, 1:08 pm EST
when would you use import vs open for to load xlsxs and sjs files?
Forums Home / Spread / SpreadJS
Posted by: peter on 30 October 2025, 1:08 pm EST
Posted 30 October 2025, 1:08 pm EST
when would you use import vs open for to load xlsxs and sjs files?
Posted 30 October 2025, 1:12 pm EST
For SSJSON, it seems you can also do
spread.fromJSON
vs
spread.import
Any advantages of one vs the other?
Posted 31 October 2025, 2:09 am EST
Hi Peter,
The import method is used when loading XLSX, CSV, or SSJSON files into the SpreadJS workbook. The open method should be used specifically for loading SJS files (the native SpreadJS file format), which provides optimized performance for such files.
Regarding spread.fromJSON vs spread.import: These methods serve different purposes. The fromJSON method loads workbook state from a general JSON object structure. The import method is the proper API for importing files (including SSJSON) with full callback support for success/error handling.
While SSJSON is technically JSON format and can be loaded with fromJSON, we recommend using the import method for SSJSON files as it’s the intended API for file import operations and provides better error handling.
Please let us know if you have any further questions.
Kind Regards,
Chirag
References: