Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support decryption of encrypted binary (XLS) spreadsheets #162

Closed
jeaguilar opened this issue Apr 11, 2019 · 4 comments
Closed

Support decryption of encrypted binary (XLS) spreadsheets #162

jeaguilar opened this issue Apr 11, 2019 · 4 comments
Assignees

Comments

@jeaguilar
Copy link

Since Spreadsheet.read() only supports opening encrypted XML format (.xlsx) spreadsheets, I use the following workaround to decrypt a binary format file (.xls):

https://gist.github.com/jeaguilar/157aa208ee90a36e53fc3ca0e012f179

@cfsimplicity
Copy link
Owner

Thanks, Juan! I wasn't aware of that factory method signature which appears to be a convenience wrapper for the decryption code that's in the POI docs.

When I tackled encryption/decryption some time ago I could only get it to work on XLSX files. Perhaps things have improved in POI 4.0 without it being documented.

Looks like this will simplify things greatly. Look out for an update soon!

@cfsimplicity cfsimplicity self-assigned this Apr 11, 2019
@cfsimplicity cfsimplicity changed the title Workaround: Use POI to decrypt a non-XML encrypted Excel spreadsheet Support decryption of encrypted binary (XLS) spreadsheets Apr 12, 2019
@cfsimplicity
Copy link
Owner

Juan, I've incorporated your workaround into the develop branch. Could you please verify that it's working for you?

Thanks
Julian.

@jeaguilar
Copy link
Author

That's excellent! It works like a champ.

SPREADSHEET = new spreadsheetDevelop.Spreadsheet();
qryFromFile = SPREADSHEET.read( src="/tmp/EncryptedSpreadsheet.xls", format="query", password="S3cr37P@ssw0rd" );
writeDump( qryFromFile );

Thanks Julian!

@cfsimplicity
Copy link
Owner

Thanks again for suggesting it, Juan. Looks like that signature was added to POI 4 years ago but the docs have never been updated. Would've saved me a lot of bother if I'd known about it, but better late than never!

Will push a new version with this to master shortly (which will also include the latest POI 4.1.0 release).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants