Win a copy of Java Mock Exams (software) this week in the Programmer Certification (OCPJP) forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Write Excel file line-by-line?

 
Matt Dalen
Greenhorn
Posts: 19
1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi, All,

I'm attempting to write a report generator that will read data from a database and create and write it to an excel file. I have it working at the moment, but the solution I found (Apache POI) requires holding the entire excel document in memory prior to writing it.  This is fine for smaller reports, but the business requirements allow for arbitrary-sized reports (eg, generate list of all records in a given table), and I'm worried about memory usage. I've seen references to an ability to write XLSX files line-by-line, but I can't find any information on how that might be done. Does anyone have any recommendations? (Note: I've tried writing csv files, but since we have large numbers in our database, we've run into the issue that Excel automatically zeroes out any digits beyond the 15th of a long number.)
 
Dave Tolls
Ranch Hand
Posts: 2369
25
  • Likes 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
SXSSF.
That's probably the one you're looking for.
 
Matt Dalen
Greenhorn
Posts: 19
1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Dave Tolls wrote:SXSSF.
That's probably the one you're looking for.


yep, that looks like it will do it!  Thanks muchly!
 
What are you doing? You are supposed to be reading this tiny ad!
the new thread boost feature brings a LOT of attention to your favorite threads
https://coderanch.com/t/674455/Thread-Boost-feature
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!