Win a copy of Java 9 Revealed this week in the Features new in Java 9 forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Write Excel file line-by-line?  RSS feed

 
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: 2554
27
  • 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!
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!