I want to execute excel file reading codes using SWITCH case but it is showing error. Kindly check the codes and let me know where i did mistake?

FileInputStream file = new FileInputStream(“C:\\Users\\Hp\\Desktop\\all folders\\project.xlsx”);

XSSFWorkbook b = new XSSFWorkbook (file);

Sheet s =b.getSheet(“proj1”);

Iterator itr = s.iterator();

while (itr.hasNext()){

Row rowitr = (Row)itr.next();

Iterator cellitr = rowitr.cellIterator();

while(cellitr.hasNext()){

Cell cell1 = (Cell)cellitr.next();

switch(cell1.getCellType()){

case Cell.CELL_TYPE_STRING:

a.add(cell1.getStringCellValue());

break;

case Cell.CELL_TYPE_NUMERIC:

a.add(cell1.getNumericCellValue());

break;

case Cell.CELL_TYPE_BOOLEAN:

a.add(cell1.getBooleanCellValue());

break;

 

Default Asked on January 18, 2018 in Selenium WebDriver.
Add Comment
  • 0 Answer(s)
  • Your Answer

    By posting your answer, you agree to the privacy policy and terms of service.