Its time to ask it in StackOverflow, since I have found more than one excel libraries, some based in client side and some based in server side.
First
I am using Node.js, where is preferred to use Excel libraries, client or server side?
Second
Which is a good Excel library you know and trust? I have tried to install this: https://github.com/natergj/excel4node But unfortune it throws the next error in the CLI:
module.js:544
throw err;
^
Error: Cannot find module 'excel4node'
at Function.Module._resolveFilename (module.js:542:15)
at Function.Module._load (module.js:472:25)
at Module.require (module.js:585:17)
at require (internal/module.js:11:18)
at Object.<anonymous> (/Users/razbuchnik/node/app.js:11:10)
at Module._compile (module.js:641:30)
at Object.Module._extensions..js (module.js:652:10)
at Module.load (module.js:560:32)
at tryModuleLoad (module.js:503:12)
at Function.Module._load (module.js:495:3)
[nodemon] app crashed - waiting for file changes before starting...
Any good advice here?
Thanks.
You can use npm install exceljs
var Excel = require('exceljs');
var workbook = new Excel.Workbook();
workbook.xlsx.readFile('old.xlsx')
.then(function() {
var worksheet = workbook.getWorksheet(1);
var row = worksheet.getRow(5);
row.getCell(1).value = 5; // A5's value set to 5
row.commit();
return workbook.xlsx.writeFile('new.xlsx');
})
See more information here, in the package's page.
Or here, in other stackoverflow answer.
Hope this help.
You can't use require('excel4node')
without install it, try npm install excel4node
to install it
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With