Reading Multiple Rows from excel using Apache POI in Selenium WebDriver

Reading Multiple Rows from excel using Apache POI in Selenium WebDriver

As we all are aware 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 multiple rows and column 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.

To start working and reading multiple values 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 named Test Data and kept it on my Desktop.



In this blog I am creating one generic utility Named “getCellData” that will loop over all the rows of excel sheets to read it.





Below is the complete code snippet. In This code, I am trying to read all the rows and columns present in the excel sheet.


Result of above code execution is






SHARE THIS

Author:

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
Anonymous
September 23, 2020 at 12:18 AM

row decalred as String object, is that correct?

Reply
avatar