Search code examples
javaexcelxssf

How to count rows and Columns of excel sheet in Java


Is there a way to count the number of rows and columns in an excel table in Java? I am using XSSF workbook to import and parse the data into the program. . There are no empty cells until after the last row or column. For example if there was a table that was 5 rows and 3 columns, cell b2 would not be empty.


Solution

  • XSSF sheet has a method called getPhysicalNumberOfRows() to get what looks like you want for rows, but I don't know about columns.