Welcome aboard! We are happy you are here and wish you good net-raft!
// at first you must install npm install officegen
var officegen = require('officegen');
var fs = require('fs');
var xlsx = officegen ('xlsx');
var myfile = fs.createWriteStream ('myxlsx.xlsx');
sheet = xlsx.makeNewSheet ();
sheet.name = 'MySheet';
var i;
for (i = 0; i < 10; i++) {
sheet.setCell ('A' + i, 'some text ' + i);
sheet.setCell ('B' + i, 'some text ' + i);
}
//sheet.data[1][3] = 'xxx'; or use this one
xlsx.generate ( myfile, {
'finalize': function ( written ) {
console.log ( 'Finish to create a excel file!' );
},
'error': function ( err ) {
console.log ( err );
}
});
The most helpful NODEJS solutions
get user ipNODEJS Click to see more ... 7.5K 1.7K