Handling Excel Files Using Apache POI In Selenium WebDriver


Selenium supports only Web browser automation. We need to get the help of third party API like Apache POI to handle (read and write) excel files using Selenium WebDriver.
What is Apache POI?
Apache POI is an open source library developed and distributed by Apache Software Foundation to design or modify Microsoft Office files using Java program. It is a popular API that allows to work around excel files using Java Programs. In short, you can read and write MS Excel files using Java. Apache POI is your Java Excel solution.
You’d use HSSF if you needed to read or write an Excel file using Java (XLS). You’d use XSSF if you need to read or write an OOXML Excel file using Java (XLSX). It has many predefined methods, classes, and interfaces.
List of different Java Interfaces and classes in POI for reading XLS and XLSX file
Workbook: HSSFWorkbook and XSSFWorkbook classes implement this interface
HSSFWorkbook: It is a class represents XLS file
XSSFWorkbook: It is a class represents XLSX file
Sheet: HSSFWorkbook and XSSFWorkbook classes implement this interface
HSSFSheet: It is a class represents a sheet in a XLS file
XSSFSheet: It is a class represents a sheet in a XLSX file
Row: HSSFWorkbook and XSSFWorkbook classes implement this interface
HSSFRow: It is a class represents a row in a sheet of XLS file
XSSFRow: It is a class represents a row in a sheet of XLSX file
Cell: HSSFWorkbook and XSSFWorkbook classes implement this interface
HSSFCell: It is a class represents a cell in a row of XLS file
XSSFCell: It is a class represents a cell in a row of XLSX file
We do handle excel files using Apache POI in Selenium WebDriver very often. Mainly coming to Automation framework (Data Driven Framework), we call the data from excel file and write the data in the excel file. Below links give an idea about Read/Write excel files using Selenium WebDriver.






How to Read Excel Files Using Apache POI In Selenium WebDriver

Followers