for getting multiple rows/columns:
CellReference ref1 = new CellReference("A36"); // First LINE 1
CellReference ref2 = new CellReference("B36");
CellReference ref3 = new CellReference("C36");
CellReference ref4 = new CellReference("D36");
XSSFRow r1 = sheet.getRow(ref1.getRow());
if (r1 != null) {
Cell a36 = r1.getCell(ref1.getCol());
Cell b36 = r1.getCell(ref2.getCol());
Cell c36 = r1.getCell(ref3.getCol());
Cell d36 = r1.getCell(ref4.getCol());
Cell e36 = r1.getCell(ref5.getCol());
AMT1 = a36.getStringCellValue();
AMT2 = b36.getStringCellValue();
AMT3 = c36.getStringCellValue();
AMT4 = d36.getNumericCellValue();
AMT5 = e36.getNumericCellValue();
AMT5A = AMT5.intValue();
}
where r1 is the first row. This takes the xlsx entry in the first designated row and assigns it to a variable (AMTx ) as shown below. Place the variable designations right after the "public class ........" line of the java file.
public static String AMT1;//Line 1
public static String AMT2;
public static String AMT3;
public static Double AMT4;
public static Double AMT5;
public static Integer AMT5A;
Note that Excel xlsx files store numbers as Double within cells -hence the conversion to integer in AMT5A.