Selenium Java Data Driven Automation - How to Read Data from Excel File

Publicado el: 13 febrero 2026
en el canal de: Lets Learn QA
188
12

Selenium Java Data Driven Automation - How to Read Data from Excel File

Step 1 = Create a Maven Project

Step 2 = Add Apache POI dependencies in POM.xml file
Apache POI
Apache POI ooxml

Step 3 - Create an excel file and save it.

Step 4 - Create object of FileInputStream to read the file.
FileInputStream fs = new FileInputStream("F:\\TestData\\SampleData.xlsx");

Step 5 - //Creating a workbook
XSSFWorkbook workbook = new XSSFWorkbook(fs);

Step 6 - //Identify Worksheet in workbook
XSSFSheet sheet = workbook.getSheetAt(1);

Step 7 - //Get the Row from worksheet
Row row = sheet.getRow(0);

Step 8 - //Get the cell from the Row Reference
Cell cell = row.getCell(0);

Step 9 - //Get the value from the cell.
System.out.println(cell.getStringCellValue());

//System.out.println(sheet.getRow(0).getCell(0));
//System.out.println(sheet.getRow(0).getCell(1));

Step 10 - //How to count total columns getLastCellNum()
System.out.println(sheet.getRow(0).getLastCellNum());

Step 11 - //How to count total Rows
System.out.println(sheet.getLastRowNum());




#javaconcepts #javainterviewquestionsanswers #seleniumjava
#datadriven #automationtesting #automationtestinginterviewquestions
#qatraining #letslearnqa


En esta página del sitio puede ver el video en línea Selenium Java Data Driven Automation - How to Read Data from Excel File de Duración hora minuto segunda en buena calidad , que subió el usuario Lets Learn QA 13 febrero 2026, comparta el enlace con amigos y conocidos, en youtube este video ya ha sido visto 188 veces y le gustó 12 a los espectadores. Disfruta viendo!