To read excel file 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.
1. How to add APACHE POI library 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 library by downloading the files
- Now you will get a screen like below.
- As shown in below image, click on the .zip link under Binary Distribution.
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.