Posted 16 August 2024, 2:38 am EST
- Updated 16 August 2024, 2:43 am EST
Hi,
The recommended method for importing .xlsx files is to use the new IO module.
The IO module, which includes “workbook.import()”, “workbook.export()”, “workbook.save()”, and “workbook.open()” APIs, was introduced in SpreadJS V16 and differs from the older ExcelIO module. The IO module improves performance by allowing Excel files to be imported directly without converting them to JSON before loading them into SpreadJS, as the ExcelIO module does. Additionally, the IO module supports the SJS file format, a SpreadJS-specific format that is essentially a zipped folder, reducing file size and improving loading performance.
Please refer to the following sample that demonstrates how to load an Excel file from a server. This sample is based on the blog post: https://developer.mescius.com/blogs/how-to-read-excel-xlsx-files-from-a-url-using-javascript
To run the attached sample, ensure that the following Chrome extension is enabled to avoid “CORS” errors: https://chromewebstore.google.com/detail/moesif-origincors-changer/digfbfaphojjndkpccljibejjbppifbc?hl=en-US
I have tested both the IO and ExcelIO modules and did not encounter any issues. Refer to the attached gif “Steps.gif” and sample “Sample.zip”. If you are using an older version, I suggest updating to the latest version and trying the IO module’s import method.
Gif:
Sample: Sample.zip
If you still experience issues, please share a sample along with the steps to replicate the behavior, or modify the existing sample to demonstrate the problem. This will help me investigate the issue more thoroughly. Additionally, it would be helpful if you could provide a GIF or video illustrating the issue.
Regards,
Priyam