Reputation: 183
Is there a way to get the index of a specific sheet "Sheet_name" using jxl?
And what does the getSheet(String name) function of jxl library do?
Thanks in advance.
Upvotes: 0
Views: 1696
Reputation: 4890
Nope, there isn't.
A very simple solution would be:
final String sheetName = "somesheet";
Integer index = null;
final Sheet[] sheets = workbook.getSheets();
for(int i=0;i<sheets.length && index == null; i++) {
if(sheets[i].getName().equals(sheetName)) {
index = i;
}
}
Upvotes: 2