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.
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.