I'm working on a NodeJS project and I need to modify an existing Excel spreadsheet but without changing the original format or links, just adding values to a couple of cells. Currently I've been using exceljs
which works very well when it comes to modify the spreadsheet but the output removes all the original styles, formats and links.
Is there another javascript npm or library that can help me with this issue or is it possible with exceljs
?
Here's what I have so far:
Fetch('url of the file')
.then(res => res.buffer())
.then(buffer => {
var workbook = new Excel.Workbook();
workbook.xlsx.load(buffer).then(function() {
var worksheet = workbook.getWorksheet(1);
var row = worksheet.getRow(4);
row.getCell(2).value = 'It works!';
row.commit();
workbook.xlsx.write(stream)
.then(function() {
// done
// here I take the stream and upload it to an AWS S3 bucket
});
});
})
Thanks!