HSSFWorkbook − This class has methods to read and write Microsoft Excel files in . xls format. It is compatible with MS-Office versions 97–2003.
How do I use XSSFWorkbook?
Fetch the given excel using FileInputStream. Get the workbook using XSSFWorkbook and fetch the required sheet as XSSFSheet object. Iterator the row with XSSFSheet. rowIterator() and then iterate the corresponding cells with Row.
How does HSSFWorkbook read data from Excel?
- Include poi-3.12.jar in your Java program’s classpath.
- Create an object of HSSFWorkBook by opening excel file using FileInputStream.
- Get a Sheet from workbook by calling getSheet() method, you can pass name or sheet index.