views:

320

answers:

3

When I tried to read an Excel file in Java it throws "biff exception".

What does this mean? I tried to Google it but wasn't able to find a proper explanation.

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:221)

                             at jxl.Workbook.getWorkbook(Workbook.java:198)

                             at Com.Parsing.ExcelFile.excel(Extract.java:20)

                             at Com.Parsing.Extract.main(Extract.java:55)
A: 

This page mentions a few exceptions in the "biff" package, perhaps that can give you further clues if you can find your particular exception there.

unwind
+2  A: 

The javadoc for BiffException.

Exception thrown when reading a biff file.

This exception has a number of messages that should provide some information about the cause:

excelFileNotFound        
excelFileTooBig         
expectedGlobals         
passwordProtected         
streamNotFound         
unrecognizedBiffVersion
unrecognizedOLEFile

Edit:

unrecognizedOLEFile seems to mean that something is embedded in the file that cannot be read.

Thomas Jung
+1  A: 

An Excel workbook with several sheets (from BIFF5 on) is stored using the compound document file format (also known as “OLE2 storage file format” or “Microsoft Office compatible storage file format”). It contains several streams for different types of data.

A complete documentation of the format of compound document files can be found at http://sc.openoffice.org/compdocfileformat.pdf

I think the exception mean that your parsing library can not recognise it(For example:biff5 format can not be parsed in POI and Jexcelapi). You can check your file version be open it in Office and click 'SAVE AS',the format list in the filedialog is it's current file version.

liya