Reputation: 305
I have a huge amount of data which I would like to stream row by row. I thought calling workbook.write(stream) after changing the value of each row would append each write onto the output stream, but I was wrong. As it is, the file size suggests/matches the amount of rows I have, but there is only 1 row inside the file itself (which is the first row written).
Is there a way to accomplish this? Much like I would be able to using a text file?
I've taken a look at the BigGrid implementation, and it looks a bit overkill for what I'm trying to do.
Thanks!
Upvotes: 1
Views: 6589
Reputation: 48386
You can't do a streaming write of the whole file in one go, the file format doesn't work like that. There are references between different parts of the file that preclude it. The file format just isn't like a CSV!
Instead, what you can do is hold a few small parts in memory, do a streaming write of the large parts of the spreadsheet to a temporary file, then re-assemble it in a low memory manner for output. To do that, look at the (fairly new) SXSSF usermodel code in POI.
Upvotes: 5