How to get excel sheet rows and column count using selenium webdriver

Selenium webdriver excelsheet row and column counts


package selenium_examples;

import java.io.FileInputStream;
import java.io.IOException;
import jxl.Sheet;
import jxl.Workbook;
import jxl.read.biff.BiffException;
import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.firefox.FirefoxDriver;

public class Sample {


 public void login() throws BiffException, IOException, InterruptedException
 {
  
 
   FileInputStream fi=new FileInputStream("F:\\Sel.xls");
   Workbook WB = Workbook.getWorkbook(fi);
   Sheet sheet = WB.getSheet("Sheet1");
   System.out.println("Number of Rows in Excel Sheet =" +sheet.getRows());
   System.out.println("Number of Columns in Excel Sheet =" +sheet.getColumns());
  
 
   fi.close();
 }

   public static void main(String[] args) throws BiffException, IOException, InterruptedException 
   {
    Sample s1=new Sample();
    s1.login();
   
   }
    
 }


Output:-
Number of Rows in Excel Sheet =7
Number of Columns in Excel Sheet =4
 

1 comment:

Anonymous said...

Thanks

Related Posts Plugin for WordPress, Blogger...