-2

I have 2 excel files, calling from TestSuite.xlsx the other TestCase.xlsx file. My 1st excel file is running successfully but when I run for other excel file getting the following error.

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:41)
at org.apache.poi.xssf.usermodel.XSSFWorkbook.<init>(XSSFWorkbook.java:204)
at com.iopendr.xls.read.Xls_Reader.<init>(Xls_Reader.java:32)
at com.iopendr.test.DriverScript.start(DriverScript.java:96)
at com.iopendr.test.DriverScript.main(DriverScript.java:60)
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:178)
at org.apache.poi.openxml4j.opc.OPCPackage.getParts(OPCPackage.java:662)
at org.apache.poi.openxml4j.opc.OPCPackage.open(OPCPackage.java:269)
at org.apache.poi.util.PackageHelper.open(PackageHelper.java:39)
... 4 more
pratik
  • 59
  • 2
  • 3
  • 11

3 Answers3

0

You need to see .xlsx file at column number 13 and verify in your code, I think it takes the another column value instead of 13th column value.

0

Try this:

Workbook workbook = new XSSFWorkbook(byteFile); //ERROR
Workbook workbook = WorkbookFactory.create(byteFile); //OK
Manuel
  • 3,828
  • 6
  • 33
  • 48
maniac787
  • 61
  • 1
  • 2
0

just open the excel sheet in MS Excel and save it in .xlsx format. then try to access it through the code.

This has worked for me.

Tushar Banne
  • 1,587
  • 4
  • 20
  • 38