0

I'm writing to an existing xlsx file using Apache POI. The code updates the value in two columns, and depending on the input it may update the value for more than 1 row as well. As you can see, after my code execution, it is supposed to enter values in PassedLinks and PassedImages columns.

util.setData(sheetName, "PassedLinks", Serial, pass+"/"+ulinks.size());
util.setData(sheetName, "PassedImages", Serial, pass+"/"+uimages.size());

But, it is not being done properly. It never updates the PassedLinks column, and sometimes it updates only the PassedImages column, that too only one of them. The method setData() correctly updates the data when we unit tested it, that too onto any column we provide. Another, probably unrelated, problem with this is that the file size grows huge even when a single cell is updated. It grows from say, 7KB to 54KB or so.

This is how the Spreadsheet looks

1

Figured it out. We were opening the FileOutputStream with append as true. This has caused the file size to increase, as well as to write only the latest data.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.