Unable to open excel file with huge data of more than 1000 elements after downloading, it is getting corrupted
RAKESHCHITTIMELA opened this issue · comments
If this was generated by SheetJS, can you share the file and the relevant code snippet?
//create a new workbook
const wb = XLSX.utils.book_new();
const sheet = XLSX.utils.json_to_sheet(finalData, {
skipHeader: true,
});
console.log('sheet', sheet);
XLSX.utils.book_append_sheet(wb, sheet, type + "_Report");
// binary large object
// Since blobs can store binary data, they can be used to store images or other multimedia files.
const workbookBlob = workbook2blob(wb);
[Clu_Detailed_Attendance_Report_8_19_2022, 10_53_36 AM.xlsx]
const workbook2blob = (workbook) => {
const wopts = {
bookType: "xlsx",
bookSST: false,
type: "binary",
};
const wbout = XLSX.write(workbook, wopts);
// The application/octet-stream MIME type is used for unknown binary files.
// It preserves the file contents, but requires the receiver to determine file type,
// for example, from the filename extension.
const blob = new Blob([s2ab(wbout)], {
type: "application/octet-stream",
});
return blob;
};
const s2ab = (s) => {
// The ArrayBuffer() constructor is used to create ArrayBuffer objects.
// create an ArrayBuffer with a size in bytes
const buf = new ArrayBuffer(s.length);
//create a 8 bit integer array
const view = new Uint8Array(buf);
//charCodeAt The charCodeAt() method returns an integer between 0 and 65535 representing the UTF-16 code
for (let i = 0; i !== s.length; ++i) {
view[i] = s.charCodeAt(i);
}
return buf;
};
Clu_Detailed_Attendance_Report_8_19_2022, 10_53_36 AM.xlsx
The attached file does not look like it was written by this library. Please uninstall and reinstall the library using the instructions from https://docs.sheetjs.com/docs/getting-started/#installation . If the issue shows up again, please share the new file and the version used (console.log(XLSX.version)
somewhere in your code)
Hi
Previously i have used excel mobile application but when i checked with excel 2019 application it is opening but in that it is not showing the CSS like header color and it is taking so much of time to open that excel file, could you please help me in this?