I have more than 2 Million rows for a search criteria in my db which i have to Export into a xlsx file. I am using apache POI SXSSF to achieve that.
I am getting the data chunk by chunk from DB with 130+ columns and writing it into WorkSheet by creating multiple sheets, each sheet has 400K rows. But i am facing the issue when it reaches 1.1M data, my code is not responding after that also it is not throwing any error as well.
I have 2 confusions based on this issue.
- Can we handle more than 1 M data on a single WorkBook.
- Can Excel handle more than 1M records on multiple sheets.
*.xlsx
workbooks in GB size already (of course not created byapache poi
) and while one sheet can only have 2^20 = 1,048,576 rows, multiple sheets having up to 1,048,576 rows each are possible in one workbook. Your problem clearly comes from too low usable RAM memory while executing. But on the other side: More than 2 million data rows in one Excel workbook sounds useless to me. Who shall be able working with those huge amount of data in Excel? – Axel RichterSXSSF
is used correctly it should not having heap space issues, right. But is it used correctly? And it creates temporary files, so it also could have issues in file system usage. And using Excel files as dump files is a bad idea in my opinion. Do usingXML
files for that. – Axel Richter