Not able to read data from Excel file using Xls_Reader, I have attached the excel file for reference | Selenium Forum
M
Mamta Posted on 18/03/2021

package runner;

import util.Xls_Reader;

public class ReadingXLS {

public static void main(String[] args) {

String filePath = System.getProperty("user.dir")+"\\src\\test\\resources\\jsons\\xls_data\\Data.xlsx";
Xls_Reader xls = new Xls_Reader(filePath);
String flag = "deleteportfolio";
String sheetName = "Portfolio Suit";
int flagRowNumber = 1;

while(!(xls.getCellData(sheetName, 0, flagRowNumber).equals(flag))) {
       String cellData = xls.getCellData(sheetName, 0, flagRowNumber);
       System.out.println("Flag row number ="+flagRowNumber+" cellData = "+cellData);
       flagRowNumber++;
       if(flagRowNumber==15)
            break;
  }
  System.out.println("Flag row number ="+flagRowNumber);
}
}

OUTPUT:

Flag row number =1 cellData =
Flag row number =2 cellData =
Flag row number =3 cellData =
Flag row number =4 cellData =
Flag row number =5 cellData =
Flag row number =6 cellData =
Flag row number =7 cellData =
Flag row number =8 cellData =
Flag row number =9 cellData =
Flag row number =10 cellData =
Flag row number =11 cellData =
Flag row number =12 cellData =
Flag row number =13 cellData =
Flag row number =14 cellData =
Flag row number =15

 


A
Ashish Replied on 23/03/2021

String sheetName = "Portfolio Suit";

should be

String sheetName = "Portfolio Suite";


M
Mamta Replied on 24/03/2021

Thanks Aashish !!!

I checked many times for spelling , but missed this somehow :)


Related Posts