2

I want to read a very large excel file using Apache POI. But it is throwing a heap size out of memory error. There is no chance I can increase the heap size.Are there any other solutions for this.

6
  • Can you read the file piece wise, by breaking into smaller chunks? Or do you need the entire file in the memory at the same time? Commented Jul 26, 2020 at 3:55
  • For one operation i can read it in small chunks, For the other I have to load the complete file. Commented Jul 26, 2020 at 3:58
  • This problem doesn't seem related to Swing. Tag removed. Commented Jul 26, 2020 at 4:16
  • "I want to read a very large excel file" BTW - is it for read only? Is there any need to update that information and write the file? Commented Jul 26, 2020 at 4:18
  • @hina If you have to load the complete file, then you will need the entire file in memory. You cannot do without extra heap space Commented Jul 26, 2020 at 12:25

1 Answer 1

3

Depending on exactly what you are trying to do, POI's streaming API might be the solution. It avoids loading the whole file into memory at the same time but is limited in its functionality.

The answers to this question might be useful as one of them suggests a library that makes working with the streaming API easier.

Sign up to request clarification or add additional context in comments.

1 Comment

Thanks for providing the link to the streaming api library. This helped me greatly!

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.