3

I am using the exceljs library in angular. I am trying to export excel using the stream WorkbookWriter as there 2M+ records but getting the following error

Here is the sample code

import * as Excel from 'exceljs';

var options = {
      filename: 'streamed-workbook.xlsx',
      useStyles: true,
      useSharedStrings: true
    };
const workbook = new Excel.stream.xlsx.WorkbookWriter(options);
        const sheet: excel.Worksheet = workbook.addWorksheet('My Worksheet');
        sheet.columns = ['header1'];
        const rows =['data1','data2','data3','data4']
        for(let i = 0; i < rows.length; i++) {
            sheet.addRow(rows[i]);
        }
        sheet.commit();
        workbook.commit().then(() => {
          console.log('done')
    
      }).catch((e) => {
         console.log('error')
      });

Any suggestion or solution ??

0 Answers0