Suppose I need to find the String "XXX" in an Excel sheet, I am not aware of how to get the column number and row number of the cell which contains the string.
Iterator<Row> it = XXXPresentSheet.iterator();
while (it.hasNext()) {
Row row = it.next();
Iterator<Cell> cellIter = row.cellIterator();
while (cellIter.hasNext()) {
String field1 = cellIter.next().getStringCellValue();
if (field1 == "XXX") {
System.out.println(someMethodThatReturnsColumnNumber());
}
}
}
I am able to traverse through the row using the cell iterator. But when I encounter the String which I want, I want to get that column number. Any help is deeply appreciated. Thanks.