Reputation: 11
I am a begginer in nightwatch js. We are in a process of creating an end to end framework using nightwatch. So for the data retrieval part we are facing difficulties to get the row and column count in an excel and parsing through the data. We did have a look into the exceljs and xlsx module but could not get any methods for that. It will be a great help if someone can share a code to get the row and column count.
Upvotes: 1
Views: 5934
Reputation: 3501
var inboundWorkbook = new Excel.Workbook();
inboundWorkbook.xlsx.readFile(req.file.path).then(function() {
var inboundWorksheet = inboundWorkbook.getWorksheet(1); //or give name of the sheet
console.log('------------- actualRowCount: ' + inboundWorksheet.actualRowCount);
console.log('------------ rowCount: ' + inboundWorksheet.rowCount);
console.log('------------ columnCount: ' + inboundWorksheet. columnCount);
inboundWorksheet.eachRow({ includeEmpty: false }, function(row, rowNumber) {
console.log("Row " + rowNumber + " = " + row.values);
});
});
Upvotes: 2