37# How to Read Excel in Selenium using Apache POI II Selenium Automation

Опубликовано: 10 Август 2026
на канале: Knowledge Share
1,416
36

In this session you will learning how to Read from Excel in Selenium using Apache POI. In easy way.

Link to GitHub Repository to get the code for practise
https://github.com/knowledgeshare-tec...

Please join Facebook Group from below link
  / 4754296501308288  

If you want to join What's app Group for Selenium Automation Discussion please leave a comment

For all other links , please scroll to the end

*********************************************
Example Program for your practice
*********************************************
package excelRead_Write;

import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.IOException;

import org.apache.poi.xssf.usermodel.XSSFCell;
import org.apache.poi.xssf.usermodel.XSSFRow;
import org.apache.poi.xssf.usermodel.XSSFSheet;
import org.apache.poi.xssf.usermodel.XSSFWorkbook;

public class ReadExcel {

public static void main(String[] args) throws IOException
{
File file=new File(System.getProperty("user.dir") + "\\TestData\\" + "Regression_TestData" + ".xlsx");
FileInputStream inputstream=new FileInputStream(file);

XSSFWorkbook wb=new XSSFWorkbook(inputstream);
XSSFSheet sheet=wb.getSheet("LoginDetails");
XSSFRow row=sheet.getRow(2);
XSSFCell cell=row.getCell(0); // Get 1st username

String username=cell.getStringCellValue();
System.out.println("User Name is : " + username );

cell=row.getCell(1);

String password=cell.getStringCellValue();
System.out.println("Password is : " + password );

// driver.findElemnt(by.xpath("ajsdkjas")).sendKeys(username));


}

}

**************************************
Important Playlists and Links below
**************************************
GitHub Repository link for basic Selenium programs for practise
https://github.com/knowledgeshare-tec...

Please check below Playlist for your easy Learning

Step-by-Step Selenium Learning Playlist
   • Selenium  

Module-wise Learning Playlist for Selenium

Selenium Module - 1 Playlist
   • Selenium - Module_1  

Selenium Module - 2 Playlist
   • Selenium - Module_2  

Selenium Module - 3 Playlist
   • Selenium - Module_3  

Selenium Module - 4 Playlist
   • Selenium - Module_4  

Selenium Module - 5 Playlist
   • Selenium - Module_5  

Selenium Module - 6 Playlist
   • Selenium - Module_6  

Selenium Module - 7 Playlist
   • Selenium - Module_7  

Selenium Module - 8 Playlist
   • Selenium - Module_8  

Framework Pre-requisites
   • Framework Pre-requisites  

Core Java Basic Concepts Playlist
   • Core Java  

OOPS Concepts Playlist
   • OOPS Concepts in Java