I have a large .xlsx excel sheet with 400,000 rows. I want to read and write in this existing workbook.
When i tried to read it in java with Apache poi, with following code:
FileInputStream fileInputStream = new FileInputStream(new File(excelPath));
Workbook wb = new XSSFWorkbook(fileInputStream);
Second line of this code takes RAM upto 5gb.
Apache POI has given a SXSSF Streaming API to handle large Excel file.
http://poi.apache.org/components/spreadsheet/how-to.html#sxssf
Now, when I instantiate SXSSF workbook with constructor without any parameter, it creates new Workbook and does not persist existing data of workbook. And other constructor of SXSSF workbook takes instance of XSSF workbook. And the problem starts arise here. When i made instance of XSSF workbook for my excel file, RAM goes high and OUTOFMEMORY exception thrown.
Is there any way to do read and write opration on existing Large excel workbook with more then 400,000 rows.