Posted 18 July 2025, 2:20 pm EST - Updated 18 July 2025, 2:21 pm EST
Dear MESCIUS Support Team,
I hope this message finds you well.
We are currently using the SpreadJS library with TypeScript in our project, and we’re facing a performance issue when importing Excel files encoded in base64 format. Specifically, when the base64 string is around 25MB, importing the file via the SDK causes the browser to freeze and eventually throws the following error:
Error code: Out of Memory
Below is the code we’re using to handle the import:
function importWorkbookFromBase64(workbook: GCType.Spread.Sheets.Workbook, workbookData: any) {
if (!workbookData?.base64Data) {
console.error('Workbook data is not provided or base64Data is missing');
return;
}
if (!workbook) {
console.error('Workbook is not initialized');
return;
}
workbook.suspendPaint();
const base64 = workbookData.base64Data;
const binaryString = atob(base64);
const len = binaryString.length;
if (len === 0) {
console.error('Base64 data is empty');
return;
}
const bytes = new Uint8Array(len);
for (let i = 0; i < len; i++) {
bytes[i] = binaryString.charCodeAt(i);
}
const file = new File([bytes], "workbook.xlsx", {
type: "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet",
lastModified: Date.now()
});
workbook.import(file, () => {
console.log("Workbook loaded successfully.");
settingUpWorkbookSheets(workbook);
workbook.resumePaint();
}, (e) => {
console.log(e);
workbook.resumePaint();
});
}
Questions:
- Are there any best practices or recommended approaches for importing large Excel files (20MB+)?
- Is there an optimized or alternative method you recommend when working with large base64 files in SpreadJS?
- Do you have any official documentation regarding size limitations or memory handling for file imports via the SDK?
Notably, when we try importing the same large file via the Spread Designer import UI, it does eventually load (after ~1 minute), so it seems the library can technically process it—though the SDK-based approach causes memory issues.
We would greatly appreciate any insights, optimizations, or official limitations you could provide.
Best regards,