I'm trying to read the xlsx file from asset folder. I received below exception,
05-16 10:12:05.613: E/AndroidRuntime(2915): FATAL EXCEPTION: main 05-16 10:12:05.613: E/AndroidRuntime(2915): java.lang.VerifyError: org/apache/poi/xssf/usermodel/XSSFWorkbook
before this exception, I received some warnings also like,
Could not find method org.openxmlformats.schemas.spreadsheetml.x2006.main.WorkbookDocument$Factory.parse, referenced from method org.apache.poi.xssf.usermodel.XSSFWorkbook.onDocumentRead
VFY: unable to resolve exception class 3612 (Lorg/apache/xmlbeans/XmlException;)
I have added poi 3.12 library on my application, libraries screenshot as below,
And I have checked poi-3.12 and poi-ooxml-3.12 jar files in Order and Export, screenshot as below,
I used below code,
InputStream is = context.getAssets().open("sample.xlsx"));
XSSFWorkbook workbook = new XSSFWorkbook(is);
XSSFSheet sheet = workbook.getSheetAt(0);
Cell cell = sheet.getRow(0).getCell(0);
String value = cell.getStringCellValue() + "";
I want to read and write the .XLSX and .XLS files. How to resolve this issue?
Thanks in Advance.
Firs you should connect to your project these jars.
Then use this code for reading
Updated your code to able to read and write the .XLSX and .XLS files
For your libraries, please have a look here android getting java lang verify error when using external java lib