You can download the jar file from here. http://poi.apache.org/
Here is the simple java code to read Excel file.
Include these jar files in the classpath.
01.
poi-3.7-20101029.jar02.
poi-ooxml-3.7-20101029.jar03.
poi-ooxml-schemas-3.7-20101029.jar04.
xbean.jar05.
dom4j-1.6.1.jar
package com.excel; import java.io.FileInputStream; import java.io.InputStream; import java.util.Iterator; import org.apache.poi.ss.usermodel.Cell; import org.apache.poi.ss.usermodel.Row; import org.apache.poi.ss.usermodel.Sheet; import org.apache.poi.ss.usermodel.Workbook; import org.apache.poi.ss.usermodel.WorkbookFactory; public class ReadExcel { public static void main (String[] args) throws Exception { InputStream is = new FileInputStream("C:/workbook.xlsx"); Workbook wb = WorkbookFactory.create(is); Sheet sheet = wb.getSheetAt(0); Iterator rowIterator = sheet.rowIterator(); while (rowIterator.hasNext()) { Row row = rowIterator.next(); Iterator cellIterator = row.cellIterator(); while (cellIterator.hasNext()) { Cell cell = cellIterator.next(); System.out.print(cell.getStringCellValue()); System.out.print(" : "); } System.out.println(); } } }
Input Excel file.
Output of the program.