Monday 17 December 2012

Selenium readexcel

import java.io.FileInputStream;

import jxl.Workbook;
import jxl.Sheet;

public class readexcel
{

    public static void main(String[] args) throws Exception
    {
     FileInputStream fs=new FileInputStream("e:\\sampledata.xls");
     Workbook wb=Workbook.getWorkbook(fs);
     Sheet ws=wb.getSheet("sheet1");
     int r=ws.getRows();
     for(int i=1;i<r;i++)
     {
         System.out.println(ws.getCell(0,i).getContents());
     }
     wb.close();
    }

}

No comments:

Post a Comment