How to get the position/index of a Sheet object in Java Apache POI

Saikat picture Saikat · Mar 18, 2017 · Viewed 8.4k times · Source

In a Java method I am using an Apache POI Sheet (from XSSFWorkbook). I can read the sheet name using getSheetName() method. But is there any way to find the sheet position in the workbook. I don't see any methods like getSheetIndex() in the Sheet interface.

Answer

user5741800 picture user5741800 · Mar 18, 2017

Not in Sheet interface but Workbook has one method to do that :

Workbook.getSheetIndex(String name);