Modify existing Excel File using node.js

后端 未结 4 1692
轻奢々
轻奢々 2021-01-03 22:38

Is there any way to modify existing excel file in node.js? I\'ve looked into exceljs but it does not provide any functionality that will just modify the existing data. It se

4条回答
  •  猫巷女王i
    2021-01-03 23:10

    You can modify excel, below is the example.

    var Excel = require('exceljs');
    async function excelOp() {
        let workbook = new Excel.Workbook();
        workbook = await workbook.xlsx.readFile('question_39869739.xlsx'); // replace question_39869739.xls with your file
        let worksheet = workbook.getWorksheet('sheetname'); // replace sheetname with actual sheet name
        worksheet.getRow('rowNumber').getCell('cellNumber').value = 350; // replace rowNumber and cellNumber with the row and cell you want to modify
        workbook.xlsx.writeFile('question_50508131.xlsx');
    }
    
    excelOp();
    

    Have a look at https://www.npmjs.com/package/exceljs#interface for all the possible operations with exceljs.

提交回复
热议问题