3

I need to know the number of rows per column. In exceljs there is a way to count the columns, but not the rows apparently. https://www.npmjs.com/package/exceljs#columns

neolith
  • 699
  • 1
  • 11
  • 20

3 Answers3

4

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;
kvipe
  • 353
  • 1
  • 2
  • 10
2

According to doc Says its supported

rowCount    The total row size of the document. Equal to the row number of the last row that has values.

Reference

https://github.com/exceljs/exceljs/issues/74

Subburaj
  • 5,114
  • 10
  • 44
  • 87
  • Those are all rows contained in the document. Not rows contained in a specified column. I used this one already. It is better than nothing, but not really precise. – neolith Oct 10 '19 at 12:17
  • there is another attribute `actualRowCount`, it will give the count of rows **excluding empty rows** in middle if any – Akshay Dec 12 '22 at 05:40
0

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.

3vangarde
  • 138
  • 1
  • 9