You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@poi.apache.org by Levi Strope <ls...@besttransport.com> on 2007/04/10 18:11:05 UTC

What is the correct method to read a large excel file line by line?

Using HSSF, what is the correct method to read large excel files line by
line?  
 
In my real world situation the excel file will be very large, over 100
megs.  I need to be able to read the file line by line so that the large
file size does not cause memory issues.
 
I have tried to use a BufferedInputStream to read in the file but that
results in invalid header exceptions when I try to do a read().  I can
use the BufferedInputStream as is if I give the whole thing to the
workbook to process.However this pretty much forces me to read in the
entire file at once does it not?
 
If anyone has any examples, or can round about hint at what I need to do
I would be most appreciative.
 
Thank you,
Levi

RE: What is the correct method to read a large excel file line by line?

Posted by Levi Strope <ls...@besttransport.com>.
I just want to clarify, as my boss is asking me to look into it further.
Per the documentation is says that using the HSSF eventusermodel is much
more efficient in terms of memory.  Does this mean that I can read in an
excel document without loading the entire document into memory first?
Reading it line by line is not a requirement, but in some cases we have
files that are over 100 meg.  I need to know if I can read it in in
pieces, or iterate through the records by request without having the
entire document loaded into memory first.  Is this possible?

Thanks
-Levi 

 

-----Original Message-----
From: Yegor Kozlov [mailto:yegor@dinom.ru] 
Sent: Tuesday, April 10, 2007 12:24 PM
To: POI Users List
Subject: Re: What is the correct method to read a large excel file line
by line?

Hi,

Current implementation reads the whole document into memory.
There is no way to read excel files line by line.

Regards,
Yegor

LS> Using HSSF, what is the correct method to read large excel files 
LS> line by line?
 
LS> In my real world situation the excel file will be very large, over 
LS> 100 megs.  I need to be able to read the file line by line so that 
LS> the large file size does not cause memory issues.
 
LS> I have tried to use a BufferedInputStream to read in the file but 
LS> that results in invalid header exceptions when I try to do a read().

LS> I can use the BufferedInputStream as is if I give the whole thing to

LS> the workbook to process.However this pretty much forces me to read 
LS> in the entire file at once does it not?
 
LS> If anyone has any examples, or can round about hint at what I need 
LS> to do I would be most appreciative.
 
LS> Thank you,
LS> Levi


---------------------------------------------------------------------
To unsubscribe, e-mail: poi-user-unsubscribe@jakarta.apache.org
Mailing List:     http://jakarta.apache.org/site/mail2.html#poi
The Apache Jakarta Poi Project:  http://jakarta.apache.org/poi/


---------------------------------------------------------------------
To unsubscribe, e-mail: poi-user-unsubscribe@jakarta.apache.org
Mailing List:     http://jakarta.apache.org/site/mail2.html#poi
The Apache Jakarta Poi Project:  http://jakarta.apache.org/poi/


Re: What is the correct method to read a large excel file line by line?

Posted by Yegor Kozlov <ye...@dinom.ru>.
Hi,

Current implementation reads the whole document into memory.
There is no way to read excel files line by line.

Regards,
Yegor

LS> Using HSSF, what is the correct method to read large excel files line by
LS> line?  
 
LS> In my real world situation the excel file will be very large, over 100
LS> megs.  I need to be able to read the file line by line so that the large
LS> file size does not cause memory issues.
 
LS> I have tried to use a BufferedInputStream to read in the file but that
LS> results in invalid header exceptions when I try to do a read().  I can
LS> use the BufferedInputStream as is if I give the whole thing to the
LS> workbook to process.However this pretty much forces me to read in the
LS> entire file at once does it not?
 
LS> If anyone has any examples, or can round about hint at what I need to do
LS> I would be most appreciative.
 
LS> Thank you,
LS> Levi


---------------------------------------------------------------------
To unsubscribe, e-mail: poi-user-unsubscribe@jakarta.apache.org
Mailing List:     http://jakarta.apache.org/site/mail2.html#poi
The Apache Jakarta Poi Project:  http://jakarta.apache.org/poi/