Excel 2007(.xlsx) Reading code using POI 3.5 in java?

核能气质少年 提交于 2019-12-24 08:39:24

问题


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


回答1:


Here is the XLSX to CSV Converter example for POI, and you can dig into svn for more examples here




回答2:


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); 


来源:https://stackoverflow.com/questions/1895483/excel-2007-xlsx-reading-code-using-poi-3-5-in-java

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!