Is there a way to count the number of rows in an Excel sheet with exceljs?

Viewed 5276
3 Answers

For me it works fine. exceljs version I use at this moment is 4.3.0

const rows = worksheet.getColumn(1);
const rowsCount = rows['_worksheet']['_rows'].length;

Yes, I also wish to do the same, it would certainly save the trouble. At the moment my "workaround" was to loop into the column and actually count it myself ... Something like:

    for(counter = 0; counter < xlCol.length; counter++) {
      if (xlCol[counter]) {
        numRec++;
      }
    }

Not exactly the ideal way it seems. Hope to get to know a better way.

Related