public class B3PassingExcelDataBase {
@Test()
//Import the data::row start at 3 and column at 1:
public static void imortingData () throws IOException {
FileInputStream file=new FileInputStream("/Users/Downloads/Book2.xlsx");
XSSFWorkbook book=new XSSFWorkbook(file);
XSSFSheet sheet=book.getSheet("Sheet1");
int rowNum=sheet.getLastRowNum();
System.out.println(rowNum);
//get the row and value and assigned to variable to use in application
for (int r=3;r<rowNum;r++) {
// Rows stays same but column num changes and this is for only one person. It iterate for other.
XSSFRow currentRow=sheet.getRow(r);
String fName=currentRow.getCell(1).toString();
String lName=currentRow.getCell(2).toString();
String phone=currentRow.getCell(3).toString();
String email=currentRow.getCell(4).toString()
//passing the data
yogen.findElement(By.name("firstName")).sendKeys(fName); ;
yogen.findElement(By.name("lastName")).sendKeys(lName); ;
yogen.findElement(By.name("phone")).sendKeys(phone); ;
}
yogen.close();
}
}