After my changing into excel file and download it to user I receive such error.
export const getExcelData = async (page: Page): Promise<Blob> => {
const key = await page.evaluate(RAIL_PORTAL.excelKey); const blob = await downloadExcel(key);
return blob; };
also when I make changes:
export const writeToExcel =async (file: ArrayBuffer, sheetName: string, changes: Changes) =>{
const newWorkbook = new ExcelJS.Workbook();
const wb = await newWorkbook.xlsx.load(file);
const ws = wb.getWorksheet(sheetName);
Object.keys(changes).map(cell => {
ws.getCell(cell).value = changes[cell];
})
return await wb.xlsx.writeBuffer({ useStyles: true })
}
I receive error that file is damaged