This week's book giveaway is in the Agile and other Processes forum. We're giving away four copies of The Mikado Method and have Ola Ellnestam and Daniel Brolund on-line! See this thread for details.
I tried that but JDeveloper is not at all responding even for just java standalone program with System.out.println("");
I have 4 GB RAM.
Please suggest is there any way to stream the data partly instead of loading entire file using Workbook workbook = WorkbookFactory.create(new File(fileDirectory, fileName)); or XSSFWorkbook xssfWb = new XSSFWorkbook(opcPackage); bcz I am getting error at this line only.
Ulf Dittmer
Marshal
Joined: Mar 22, 2005
Posts: 35243
7
posted
0
I'm fairly certain that POI can only deal with complete files; there's no way to make it read partial files (and thus lower the memory consumption). That line is probably where POI tries to read the entire file into memory.
(My first name is Ulf, by the way. It's fine to address me with my last name if you prefer to do so, but then the polite way to do so is by prefixing it with "Mr.".)
Harinath Br wrote:Please suggest is there any way to stream the data partly instead of loading entire file using Workbook workbook = WorkbookFactory.create(new File(fileDirectory, fileName)); or XSSFWorkbook xssfWb = new XSSFWorkbook(opcPackage); bcz I am getting error at this line only.
No, that's not how the WorkbookFactory class works.
It might be possible to use other features of the POI project to provide a "streamed" version of the data, but I don't know that for sure. Somehow I doubt it, because I'm not sure what exactly would be streamed. It's easy for somebody who just thinks of Excel as a grid with cells which might contain data to ask for that, but for somebody who has to write code which can deal with all of the thousands of different kinds of objects which might be present in an Excel document, it isn't really all that simple.
Harinath Br
Greenhorn
Joined: Aug 28, 2012
Posts: 4
posted
0
Thanks everyone for the reply.
I have done in this way... I have split the file with 20k records per file (around 5MB) as workaround in this case.