This blog is for Automation Test Engineers

Tuesday, 29 August 2017

How to print the contents of excel file



FileInputStream fis=new FileInputStream("E:\\test.xlsx");
Workbook wb=new WorkbookFactory.create(fis);
Sheet s=wb.geSheet("Sheetname");
int rowcount=s.getLastRowNum();
for(int j=0;j<rowcount;j++){
Row r =s.getRow(j);
int columncount=r.getLastCellNum();
for(int a=0;a<columcount;a++){
Cell c=r.getCell(a);
String s=c .getStringCellValue();
System.out.println(s);
}


0

0 comments:

Post a Comment