'xlsx: Removed Records: Document Theme from /xl/workbook.xml part (Workbook). - using Excel.js

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



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source