Row Count And Column Count In Excel

preview_player
Показать описание
Please use the following link to install the Katalon Studio:

Row count and column count in excel will discuss how we can get the information about row count and column count of an excel while automating any application using selenium web driver. Usually we will use the excel sheet to maintain the test data. We might get doubt that why we need to put the test data/results in excel. If an application need so much of data to be feed to test; then we will manage those data using external sources like text file, xml file and excel file etc… . Among these; Excel is very user friendly that we can organize the data very easily and we can read and write the data how we want. So, we mostly use excel to maintain the test data and results. In order to create a data driven framework then it is easy with using excel.

So, if you want to read huge number of test data from the excel sheet to feed to the application then we need to know how many rows and columns are there in the excel. If you know exact information about the test data then only we can get the information from the excel in proper way. For this we need to use some third party API which are available. In those one of the famous is Apache POI. In this blog we will use Apache POI to get the row count and column count from the excel sheet. To interact with the excel, Apache POI given so many classes to interact with the excel and read and write the data. To read/write excel data we will use Java and Apache POI classes.

Below are the classes will use to read/write the data:

FileInputStream – A FileInputStream is an inputstream for reading data from a File.
XSSFWorkbook
XSSFSheet
XSSFRow
XSSFCell

Below are the methods will use to read/write the data which are available in the above classes:

getSheet(“sheetName”) – Get sheet with the given name
getLastCellNum() – Get the index of the last cell contained in the row Plus one as index starts from ZERO
getLastRowNum()
Рекомендации по теме
Комментарии
Автор

I have one Question - - - - Why does Row num start from 0 and Cell num start from 1 ? I am so confused about can you clear my doubt...

rohitnalkar