Skip to content

Instantly share code, notes, and snippets.

@CuongNgMan
Forked from sreepurnajasti/readSheet.js
Created September 8, 2022 11:07
Show Gist options
  • Save CuongNgMan/5e6fd0a08cb93282ebb702c454a66753 to your computer and use it in GitHub Desktop.
Save CuongNgMan/5e6fd0a08cb93282ebb702c454a66753 to your computer and use it in GitHub Desktop.
Reading xlsx, csv files using exceljs in node
var Excel = require('exceljs');
var workbook = new Excel.Workbook();
workbook.xlsx.readFile('../../storage/cust_88ae31d4-47c5-4f70-980e-7b473ba20ef9/xls.xls')
.then(function() {
var worksheet = workbook.getWorksheet('Sheet1');
worksheet.eachRow({ includeEmpty: true }, function(row, rowNumber) {
console.log("Row " + rowNumber + " = " + JSON.stringify(row.values));
});
});
workbook.csv.readFile('../../storage/cust_88ae31d4-47c5-4f70-980e-7b473ba20ef9/gd1.csv')
.then(function(worksheet) {
worksheet.eachRow({ includeEmpty: true }, function(row, rowNumber) {
console.log("Row " + rowNumber + " = " + JSON.stringify(row.values));
});
})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment