This week's book giveaway is in the Servlets forum.
We're giving away four copies of Murach's Java Servlets and JSP and have Joel Murach on-line!
See this thread for details.
The moose likes Other Open Source Projects and the fly likes Write Huge Excel file (.Xlsx) POI and Java -  java.lang.OutOfMemoryError: Java heap space Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Products » Other Open Source Projects
Bookmark "Write Huge Excel file (.Xlsx) POI and Java -  java.lang.OutOfMemoryError: Java heap space" Watch "Write Huge Excel file (.Xlsx) POI and Java -  java.lang.OutOfMemoryError: Java heap space" New topic
Author

Write Huge Excel file (.Xlsx) POI and Java - java.lang.OutOfMemoryError: Java heap space

Julio leopard banderas
Greenhorn

Joined: Dec 20, 2012
Posts: 29
Hi everyone,
I'm looking for solution to write an excel file (.Xlsx) with data from database,

For example :
----------------

Code to write Xlsx file:
--------------------------


But this code give me an ERROR :


I found a solution in http://www.coderanch.com/t/424181/open-source/Read-xls-xlsx-file-format
it work verry fine but ionly for reading huge Excel file

Thanks
Olivier Rihoux
Greenhorn

Joined: Jun 03, 2013
Posts: 8
Just USE SXSSF components that keeps only small part of your file in memory

Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 41063
    
  43
Unless the "55555" is an actual number (and not just for testing) you could also try bumping up the JVM memory. Its default allocation is a LOT smaller than what most desktops and servers have available in unused memory.

Using Oliver's approach will probably give you more peace of mind, though :-)


Ping & DNS - my free Android networking tools app
Meer Nasirudeen
Greenhorn

Joined: Sep 30, 2007
Posts: 4
Hello everyone... I too faced the same issue of OOM while parsing xlsx file...after two days of struggle, I finally found out the below code that was really perfect;

This code is based on sjxlsx. It reads the xlsx and stores in a HSSF sheet.



 
Consider Paul's rocket mass heater.
 
subject: Write Huge Excel file (.Xlsx) POI and Java - java.lang.OutOfMemoryError: Java heap space
 
Similar Threads
Out of Memory Error - Java Heap Space while writing to Excel
How to read .xlsx sheet from Client Side using poi 3.5
Problem in creating Workbook with .xlsx file
Creating Workbook with .xlsx file
data from data base to excel in servlet