Reading Specific value from excel using Apache POI in Selenium WebDriver

Reading Specific value from excel using Apache POI in Selenium WebDriver

As we all are aware of reading and writing data from excel file is one of the most important aspects that we need to take care while designing our automation testing framework especially while using a data-driven testing approach.

So in this Section, we will learn how we can read any single data value from excel file which contains a large set of data.

Apache POI API is an open-source library created by Apache Software that allows us to create, modify and work with other Microsoft Office Product.

To Know more about the Apache POI API and its components. Please refer to this link.

So to start working and reading any specific value from excel we first need to download Apache POI maven dependency or JAR. Please click on this link to download this from the maven repository.

In this Section I am using below maven dependencies.

For Demo purpose I have created below excel sheet and kept it on my Desktop.

In this blog I am creating one generic utility Named “getCellData” that can be called by just passing row and column of the excel file for which we wanted to read data.

Below is the complete code snippet. Here I am trying to read data from eight row and first column.

For reading any specific value for any row and column number we need to pass that value in getCellData through the main method.

Result of above code execution is



My Name is Ankur Jain and I am currently working as Automation Test Architect.I am ISTQB Certified Test Manager,Certified UI Path RPA Developer as well as Certified Scrum Master with total 12 years of working experience with lot of big banking clients around the globe.I love to Design Automation Testing Frameworks with Selenium,Appium,Protractor,Cucumber,Rest-Assured, Katalon Studio and currently exploring lot in Dev-OPS as well. I am currently staying in Mumbai, Maharashtra. Please Connect with me through Contact Us page of this website.

Previous Post
Next Post