Am new to Java and I have challenge in validating the excel file.Please help me.
I want to validate that 'Hyderabad' is the location Name and '1' is the location ID from excel(pls screenshot below)through JAVA .Am able to read all the cell values.But I want to verify whether Location Name is Hyderabad or not(Similarly , the location ID).Please suggest me here.
if (fileType.equalsIgnoreCase("Excel")) {
Workbook wb = new XSSFWorkbook(f);
for (int i = 0; i < wb.getNumberOfSheets(); i++) {
System.out.println("Sheet name: " + wb.getSheetName(i));
Sheet sh=wb.getSheetAt(i);
if (wb.getSheetName(i).matches("A|B|C|D"))
{
int rowCount = sh.getLastRowNum() - sh.getFirstRowNum();
for (int j = 0; j < rowCount + 1; j++) {
Row row = sh.getRow(j);
for (int k = 0; k < row.getLastCellNum(); k++) {
System.out.print(row.getCell(k).getStringCellValue() + "|| ");
}
}
}
}