javascriptnode.jsexcelexceljs

Make a data table using exceljs


I'm trying to format some data into a Excel table, I already have the data written in the Excel file, but I want it as a table, is there any way to do this, if not, is there any way with another npm package


Solution

  • You could convert the range to table:

    const sheet = context.workbook.worksheets.getItem("Sample");
    let expensesTable = sheet.tables.add("A1:E7", true);
    expensesTable.name = "ExpensesTable";
    

    here is the sample gist that you could have a try https://gist.github.com/lumine2008/8eccb88f7fccf34b63c7ecd5fd05aaea