title: Cannot get a STRING value from a NUMERIC cell?
body: <p>I Was Executing Test Scripts Though Excel Sheet Using Keyword Driven Data Framework.</p>
  
  <p>While Executing Am Geting Error as :</p>
  
  <blockquote>
    <p>java.lang.RuntimeException: java.lang.IllegalStateException: Cannot
    get a STRING value from a NUMERIC cell</p>
  </blockquote>
  
  <p>My Selenium Code is</p>
  
  <pre><code>    package DemoData;
  
  import java.util.concurrent.TimeUnit;
  
  import org.openqa.selenium.By;
  import org.openqa.selenium.WebDriver;
  import org.openqa.selenium.chrome.ChromeDriver;
  import org.testng.Assert;
  import org.testng.annotations.AfterMethod;
  import org.testng.annotations.DataProvider;
  import org.testng.annotations.Test;
  
  import DataConfig.ExcelDataConfig;
  
  public class ReadArrayData 
  {
  
      WebDriver driver;
  
  
    @Test(dataProvider="Tipreports")
    public void Dataprovider(String username, String password) throws InterruptedException
    {
        System.setProperty("webdriver.chrome.driver", "F:\\New folder\\chromedriver.exe");
  
        driver = new ChromeDriver();
  
        driver.get("http://xxxxxxxxxxxxxxxx/");
  
        driver.manage().timeouts().implicitlyWait(20, TimeUnit.SECONDS);
  
        driver.manage().window().maximize();
  
        driver.findElement(By.id("txt_username")).sendKeys(username);
  
        driver.findElement(By.id("txt_pin")).sendKeys(password);
  
        driver.findElement(By.xpath("//*[@id='btn_click']")).click();
  
        Thread.sleep(5000);
  
        //driver.getCurrentUrl();
  
        Assert.assertTrue(driver.getCurrentUrl().contains("http://xxxxxxxxxxxxx/Algorithm_Run.aspx"),"User Not able to Login - Invalid Credentials");   
  
    }
  
    @AfterMethod
    public void Close()
    {
        driver.quit();
    }
  
    @DataProvider(name="Tipreports")
    public Object[][] passdata()
    {
  
        ExcelDataConfig config = new ExcelDataConfig("E:\\Workspace\\KeywordFramework\\TestData\\Dataprovider.xlsx");
           int rows = config.getRowCount(0);
  
           Object[][] data = new Object[rows][2];
  
           for(int i=0;i&lt;rows;i++)
           {
               data[i][0]=config.getData(0, i, 0);
               data[i][1]=config.getData(0, i, 1);
  
           }
          return data;
  
    }
  
  }
  </code></pre>
  
  <p>Here is My Excel Data Config Code :</p>
  
  <pre><code>package DataConfig;
  
  import java.io.File;
  import java.io.FileInputStream;
  
  import org.apache.poi.xssf.usermodel.XSSFSheet;
  import org.apache.poi.xssf.usermodel.XSSFWorkbook;
  
  public class ExcelDataConfig 
  {
      XSSFWorkbook wb;
      XSSFSheet Sheet1;
  
      public ExcelDataConfig(String excelpath)
      {
          try
          {
              File src = new File(excelpath);
              FileInputStream fis = new FileInputStream(src);
              wb= new XSSFWorkbook(fis);
          }
          catch(Exception e)
          {
              System.out.println(e.getMessage());
          }
      }
  
      public String getData(int sheetnumber, int row, int column)
      {
          Sheet1 = wb.getSheetAt(sheetnumber);
  
          String data =Sheet1.getRow(row).getCell(column).getStringCellValue();
  
          return data;
  
      }
  
      public int getRowCount(int sheetindex)
      {
          int row = wb.getSheetAt(sheetindex).getLastRowNum();
  
          row = row+1;
  
          return row;
      }
  
  }
  </code></pre>
  
  <p>Can you please help me to sort out this, Why am getting this error? I have declared <code>2 Columns and 4 Rows</code> using for loop. But am getting cannot Get The error as cannot get the string value  from Numeic Cell.</p>