Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

BiffException while reading an excel sheet

Tags:

excel

jxl

I have a code to read from an excel sheet which is in old format(97-2003). I made some changes to data and ended up a 2007 format excel sheet. When I used this xlsx sheet instead of xls sheet, I am getting this:

jxl.read.biff.BiffException: Unable to recognize OLE stream
    at jxl.read.biff.CompoundFile.<init>(CompoundFile.java:116)
    at jxl.read.biff.File.<init>(File.java:127)
    at jxl.Workbook.getWorkbook(Workbook.java:268)
    at readexcel.ReadExcel.readContent(ReadExcel.java:50)
    at readexcel.ReadExcel.init(ReadExcel.java:25)
    at readexcel.ReadExcel.main(ReadExcel.java:183)
like image 849
nowfal Avatar asked Mar 25 '11 05:03

nowfal


1 Answers

The xls format (< Excel 2007) is comprised of binary BIFF data in an OLE container. The xlsx format (>= Excel 2007) is comprised of XML files in a zip container.

The Java Excel API only deals with the first format so it throws an exception when it doesn't encounter an OLE container.

You will need to restrict your input to xls files only or find another tool that handles both formats.

like image 101
jmcnamara Avatar answered Sep 29 '22 03:09

jmcnamara