File file = new File(filePath); XSSFWorkbook wb = new XSSFWorkbook(new FileInputStream(filePath)); XSSFSheet sheet = wb.getSheet(sheetName); int rows = sheet.getPhysicalNumberOfRows() Row row1 = sheet.getRow(1) log.info row1.getPhysicalNumberOfCells()