How to get the last column index reading excel file?

marcosbeirigo picture marcosbeirigo · Feb 3, 2010 · Viewed 47.9k times · Source

How do i get the index of the last column when reading a xlsx file using the Apache POI API?

There's a getLastRowNum method, but I can't find nothing related to the number of columns...


EDIT: I'm dealing with XLSX files

Answer

Henning picture Henning · Feb 3, 2010

I think you'll have to iterate through the rows and check HSSFRow.getLastCellNum() on each of them.