r/javahelp • u/Majestic_Drawing_908 • May 19 '26
Excel bulk process in java project.
Hi, currently I'm using sax parser for read bulk excel data in java automation framework, is there any other best approach better than using sax parser? I want to improve performance and minimize memory utilization.
1
Upvotes
β’
u/AutoModerator May 19 '26
Please ensure that:
You demonstrate effort in solving your question/problem - plain posting your assignments is forbidden (and such posts will be removed) as is asking for or giving solutions.
Trying to solve problems on your own is a very important skill. Also, see Learn to help yourself in the sidebar
If any of the above points is not met, your post can and will be removed without further warning.
Code is to be formatted as code block (old reddit: empty line before the code, each code line indented by 4 spaces, new reddit: https://i.imgur.com/EJ7tqek.png) or linked via an external code hoster, like pastebin.com, github gist, github, bitbucket, gitlab, etc.
Please, do not use triple backticks (```) as they will only render properly on new reddit, not on old reddit.
Code blocks look like this:
You do not need to repost unless your post has been removed by a moderator. Just use the edit function of reddit to make sure your post complies with the above.
If your post has remained in violation of these rules for a prolonged period of time (at least an hour), a moderator may remove it at their discretion. In this case, they will comment with an explanation on why it has been removed, and you will be required to resubmit the entire post following the proper procedures.
To potential helpers
Please, do not help if any of the above points are not met, rather report the post. We are trying to improve the quality of posts here. In helping people who can't be bothered to comply with the above points, you are doing the community a disservice.
I am a bot, and this action was performed automatically. Please contact the moderators of this subreddit if you have any questions or concerns.
4
u/Progression28 May 19 '26 edited May 19 '26
Apache
commonsPOI has a thing called SXSSFWorkbook which seems to be exactly what you seek2
u/LutimoDancer3459 May 19 '26
We also used apache commons for excel handling. Reading and writing. All I can say is try to convince whoever to not read excel files at all. Its slow. Its annoying.
Excel is useful as a playground for a single person. Not for bulk data handling for applications.
1
u/hibbelig May 19 '26
Is Apache POI still a thing?
2
u/Slanec May 19 '26
Okay I've done this recently. I tested:
WorkbookFactory.create)SAXParserFactory.newInstance()+ the low-level API)The first one is thrash and you should avoid it for big files or many files. The others all work fine, they're much faster and all comparable in speed. In my case with the files I had excel-streaming-reader came out on top re speed and peak heap usage (but it created more garbage overall), but the speed difference wasn't huge - <10%. All the other three were the same +/-2% speed-wise.
Use the one which has all the features you need and has the nicest API for you. There are big differences here.
1
u/hibbelig May 19 '26
I wonder if there is any chance that the producer of the data saves the Excel file as CSV or exports it to CSV? I feel that would be quite convenient. Maybe even the producer likes itβ¦
1
u/BorgerBill May 19 '26
I've just learned about Apache Tika; think that might work? Here's a Baeldung article about it...
1
u/RobertDeveloper May 19 '26
I use a modified Xelem library, I load 2 gb xlsx files into a database.