How to read large file in browser without crashing
kikiren opened this issue · comments
Input is a .xlsx file of 68MB to be parsed to json, and browser crashed. Is there a better way to read large file from browser?
const data = await this.file.arrayBuffer();
const workbook = XLSX.read(data,{
sheets: 0,
}); // here is no return
const sheetNames = workbook.SheetNames;
const worksheet = workbook.Sheets[sheetNames[0]];
const json = XLSX.utils.sheet_to_json(worksheet);
You can try XLSX.read(data,{ dense: true })
but it is likely that the underlying XML is beyond the string length limit.
Please test
const workbook = XLSX.read(data,{
sheets: 0,
dense: true,
});
If this still hangs, please share the file and we can take a closer look