How to add APACHE POI in Selenium Project – 2 Simple Steps

apache poi in Selenium

To read excel files using Java, APACHE POI is  the most used library for working with Excel workbooks in Selenium Automation projects. There are two ways you can add these jars to your automation project.

One way is through the POM.xml in  your maven project and the other way is by downloading the jars directly from Apache website and adding them in build path of your automation project. Let’s see how to add APACHE POI in Selenium both the ways.

1. How to add APACHE POI in Selenium through Maven

To add the POI library using Maven, Please copy below dependency code in your POM.xml and download these dependencies by updating your project.

<!-- https://mvnrepository.com/artifact/org.apache.poi/poi -->
<dependency>
    <groupId>org.apache.poi</groupId>
    <artifactId>poi</artifactId>
    <version>5.0.0</version>
</dependency>

<!-- https://mvnrepository.com/artifact/org.apache.poi/poi-ooxml -->
<dependency>
    <groupId>org.apache.poi</groupId>
    <artifactId>poi-ooxml</artifactId>
    <version>5.0.0</version>
</dependency>
2. How to add APACHE POI in Selenium by downloading the files

If you are not using the Maven for building your project, you can download the complete APACHE POI library by going to the link. APACHE POI Library

  • You will get screen like below.
  • As shown in the below image, Click on the link “The latest stable release is…”.
apache poi in Selenium
  • Now you will get a screen like below.
  • As shown in below image, click on the .zip link under Binary Distribution.
apache poi in Selenium

After downloading the zip file, extract and add the all the included jar files as the External Jars in the build path of your project.

As shown in the image below, add all the jars in the main folder and subsequently auxiliary folder, lib folder and ooxml-lib folder.

apache poi in Selenium

Discover more from Automation Script

Subscribe to get the latest posts sent to your email.

Related Posts