Error while reading xlsx file from apache open office | Selenium Training|Java|WebDriver|TestNG|Frameworks|Videos

Error while reading xlsx file from apache open office

M
Post on 31/08/2015

org.apache.poi.POIXMLException: org.apache.poi.openxml4j.exceptions.InvalidFormatException: Package should contain a content type part [M1.13]
at org.apache.poi.util.PackageHelper.open(PackageHelper.java:39)
at org.apache.poi.xssf.usermodel.XSSFWorkbook.<init>(XSSFWorkbook.java:258)
at com.qtpselenium.util.Xls_Reader.<init>(Xls_Reader.java:34)
at test.qtpselenium.com.SuiteRunmode.main(SuiteRunmode.java:10)
Caused by: org.apache.poi.openxml4j.exceptions.InvalidFormatException: Package should contain a content type part [M1.13]
at org.apache.poi.openxml4j.opc.ZipPackage.getPartsImpl(ZipPackage.java:203)
at org.apache.poi.openxml4j.opc.OPCPackage.getParts(OPCPackage.java:673)
at org.apache.poi.openxml4j.opc.OPCPackage.open(OPCPackage.java:274)
at org.apache.poi.util.PackageHelper.open(PackageHelper.java:37)
... 3 more
Exception in thread "main" java.lang.NullPointerException
at com.qtpselenium.util.Xls_Reader.getRowCount(Xls_Reader.java:45)
at test.qtpselenium.com.SuiteRunmode.isSuiteRunnable(SuiteRunmode.java:19)
at test.qtpselenium.com.SuiteRunmode.main(SuiteRunmode.java:11)


////

anyone knows solutions for this? I googled it and tried out some solutions but they are not upto mark

M
Reply on 31/08/2015

what is the file you reading?
xls or xlsx

xls reader only works with xlsx