xls - Get Row Number

Code to get the row number for the selected cell:

1
2
3
4
5
6
7
8
public int getCellRowNum (String sheetName, String colName, String cellValue) {
 for(int i = 2; i <= getRowCount (sheetName); i++){
  if (getCellData (sheetName, colName, i).equalsIgnoreCase (cellValue)) {
   return i;
  }
 }
 return -1;     
}