Java library to convert "X-Document-Type: Workbook" to Excel

286 Views Asked by At

We have some legacy data in .xls (HSSF) format that we are converting to .xlsx (XSSF) format using Apache POI library. It was all working very well till we started seeing many org.apache.poi.poifs.filesystem.NotOLE2FileException. Upon closer examination we realized that the files that are throwing this exception are not actually Excel files (despite the misleading .xls extension) but Single File Web Page files (web archive X-Document-Type: Workbook).


Question) Is there any opensource Java library that converts "X-Document-Type: Workbook" to Excel?


Addendum: Clarification, as sought by @kiwiwings

No the files are not "XML Workbook" format. They are MIME documents with the X-Document-Type: Workbook declaration. Each part is a standard HTML file, with its own table.

The files are given the .xls extension and Excel is able to open them, albeit after issuing the following warning:

The file you are trying to open, 'blah-blah-blah.xls', is in a different format than specified by the file extension. Verify that the file is not corrupted and is from a trusted source before opening the file. Do you want to open the file now?

0

There are 0 best solutions below