Bug 61397 - Unable to read excel using HSSFWorkbook in poi 3.8 but works fine in 3.0, I cannot downgrade the version.
Summary: Unable to read excel using HSSFWorkbook in poi 3.8 but works fine in 3.0, I c...
Status: RESOLVED INVALID
Alias: None
Product: POI
Classification: Unclassified
Component: HSSF (show other bugs)
Version: unspecified
Hardware: PC All
: P2 blocker (vote)
Target Milestone: ---
Assignee: POI Developers List
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2017-08-10 06:34 UTC by Manju
Modified: 2017-09-13 20:01 UTC (History)
0 users



Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Manju 2017-08-10 06:34:52 UTC
I am using an excel of version Microsoft Excel 97-2003 Worksheet (.xls). I am trying to read the excel in java using following code. I am using poi 3.8 version
 fis = new FileInputStream(filename);
 HSSFWorkbook workbook = new HSSFWorkbook(fis);

I am getting the following error. 
Exception in thread "main" java.lang.RuntimeException: Unexpected record type (org.apache.poi.hssf.record.ColumnInfoRecord)
	at org.apache.poi.hssf.record.aggregates.RowRecordsAggregate.<init>(RowRecordsAggregate.java:107)
	at org.apache.poi.hssf.model.InternalSheet.<init>(InternalSheet.java:208)
	at org.apache.poi.hssf.model.InternalSheet.createSheet(InternalSheet.java:163)
	at org.apache.poi.hssf.usermodel.HSSFWorkbook.<init>(HSSFWorkbook.java:296)
	at org.apache.poi.hssf.usermodel.HSSFWorkbook.<init>(HSSFWorkbook.java:248)
	at org.apache.poi.hssf.usermodel.HSSFWorkbook.<init>(HSSFWorkbook.java:192)
	at org.apache.poi.hssf.usermodel.HSSFWorkbook.<init>(HSSFWorkbook.java:327)
	at org.apache.poi.hssf.usermodel.HSSFWorkbook.<init>(HSSFWorkbook.java:308)
	at com.wona.ExcelExtractService.main(ExcelExtractService.java:28)


It works fine in poi 3.0 version, but i cannot downgrade to an older version.

On opening in excel and resaving it in different name the new excel works fine. I cannot resave the excel and use all the time. Need a fix for it.
Comment 1 Javen O'Neal 2017-08-10 06:55:54 UTC
Have you tried to open the workbook with a newer version of POI, such as POI 3.16? 3.8 is pretty old.

Are you able to share the Excel file?
Comment 2 Dominik Stadler 2017-09-13 20:01:19 UTC
Sorry, we cannot help much if you can not provide any additional information here.