1

I have downloaded latest POI version 3.5. I want to read the Excel file (.xlsx format) using the POI.

If anybody has any Example source code or any URL or any other code snippet which can read the Excel file (.xlsx format) using the latest version of POI,which would be appreciated.

Thanks,

Mishal Shah

Developer
  • 1,009
  • 8
  • 25
  • 56

2 Answers2

1

Here is the XLSX to CSV Converter example for POI, and you can find more examples here.

ib.
  • 27,830
  • 11
  • 80
  • 100
YOU
  • 120,166
  • 34
  • 186
  • 219
  • Thanks for help.I have taken the sample codes from it but still i am getting one weird problem.if you knew or faced such kind of problem. I have added all the POI 3.5 provided jars into the project.But, in the netbeans and eclipse in both cases it is giving error/exception. Generated exception is below: Exception in thread "main" java.lang.NoClassDefFoundError: org/apache/xmlbeans/XmlException at ExcelSheetCreation.main(ExcelSheetCreation.java:38) All the users having same kind of problem and nothing like whole solution given. Please help me out in this case also. Thanks, Mishal Shah – Developer Dec 14 '09 at 02:17
0

Below is the code snipet which can help you for reading excel 2007 format file... Actually there are 2 diff class for reading excel file one is for the up to excel 2003 and one is latest one...

Code >>>

InputStream inputStream = new FileInputStream(destDir); 
POIFSFileSystem fileSystem = new POIFSFileSystem(inputStream); 
XSSFWorkbook workBook = new XSSFWorkbook(salesFileName); 
XSSFSheet sheet = workBook.getSheetAt(0); 
totalRows = sheet.getPhysicalNumberOfRows(); 
System.out.println("total no of rows >>>>"+totalRows);