I wrote code opening an Excel file (XLS or XLSX) with an InputStream. I modify the file, then I save it back. Worked well. Re-reading the doc, I see that WorkbookFactory.create(File) uses less resources, so I used this method instead. All my tests failed. I got, for XLSX, a message "Can't obtain the input stream from /docProps/app.xml", and for XLS, a message about an index out of bounds. After investigation, I found I was not alone: http://stackoverflow.com/questions/14117617/apache-poi-unable-to-write-to-an-existing-workbook So I just reverted to read my file from an input stream (it isn't big anyway). I can understand it can be a limitation of the underlying system (Windows 7 here). But I suggest you put a warning against this kind of usage, when you recommend to use this form of opening. If you have a fix, or at least a way to make a friendlier error message, it would be even better...
This will be addressed in bug 58779, either as a documentation update or a change in behavior to workbook.close(). *** This bug has been marked as a duplicate of bug 58779 ***