I am using XSSFWorkbook for parsing xlsx files (only reading data). For XSSFWorkbook creation I am using following constructor: XSSFWorkbook(String path) After testing my solution I discovered that there is some unexpected non-transparent undesired behavior: after closing workbook (I am using try with resources construction) source file is rewritten updated by its compressed version; this is unexpected for me since file is opened only for reading data. Using following workaround changes this behavior: static Workbook getWorkbook(String fullFileName) throws IOException { try { return new XSSFWorkbook(OPCPackage.open(fullFileName, PackageAccess.READ)); } catch (InvalidFormatException e) { throw new IOException(e.toString(), e); } } Library version used in my solution is 5.2.5 (not present in version dropdown).
This has long been the behaviour and we can't change pre-existing behaviour. We could potentially ass a new constructor to XSSFWorkbook -- eg public XSSFWorkbook(String, PackageAccess)
It would be nice to add new constructor, I agree.