How to add a new row at the beginning of a existing excel sheet using exceljs

Viewed 40

It adds at the end of the sheet. I want to add at the beginning. How can I do it using exceljs

workbook.xlsx.readFile(nameFileExcel)
.then(function()  {
    var worksheet = workbook.getWorksheet(2);
    var lastRow = worksheet.lastRow;
    var getRowInsert = worksheet.getRow(++(lastRow.number));
    getRowInsert.getCell('A').value = 'yo';
    getRowInsert.commit();
    return workbook.xlsx.writeFile(nameFileExcel);
});
0 Answers
Related