我想读写Excel文件。但我不希望他将数据写入他读取的文件中。
var Excel = require('exceljs');
var workbook = new Excel.Workbook();
workbook.xlsx.readFile("test.xlsx").then(function () {
var worksheet=workbook.getWorksheet('Sheet1');
var row=worksheet.getRow(1);
var cell=row.getCell(1).toString();
var cell1=row.getCell(2).toString();
console.log(cell+" "+cell1);
});
workbook.xlsx.writeFile("yazdir.xlsx").then(function() {
var worksheet=workbook.getWorksheet('Sheet1');
var row=worksheet.getRow(1);
row.getCell(2).value = "getcell value"; //
row.commit();
return workbook.xlsx.writeFile("yazdir.xlsx");
});
我的test.xlsx文件:https://ibb.co/SyXw8NR