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

[Draft] read encrypted xlsx files #692

Closed
wants to merge 10 commits into from
Closed

[Draft] read encrypted xlsx files #692

wants to merge 10 commits into from

Conversation

JanMarvin
Copy link
Owner

@JanMarvin JanMarvin commented Jul 15, 2023

Using a slightly modified version of https://github.com/maharmstone/xlcpp/ to decrypt password protected xlsx files. If a password is provided, we should be able to decrypt the xlsx file. The decrypted file is written to disk and imported.

I do not really like this

  • Initially I was aiming to get https://github.com/tfussell/xlnt working. But while they have the cryptography files all sorted in a nice little folder, when I was building, I always ran into a wall. My issue is, that the crypto files are not simply to extract into an independent library.
  • xlcpp is aiming for its own workbooks and I built the entire library, just for the decryption part, so this has to be cleaned out.
  • It depends on libarchive (not sure this is needed) and C++20 features.
  library(openxlsx2)
  fl <- "https://github.com/JanMarvin/openxlsx-data/raw/main/openxlsx2_example_pass.xlsx"
  
  wb <- wb_load(fl, password = "openxlsx2")

@JanMarvin JanMarvin changed the title read encrypted xlsx files [Draft] read encrypted xlsx files Jul 15, 2023
@JanMarvin
Copy link
Owner Author

Ah whatever, you have to take my word for it that it builds :)

@JanMarvin JanMarvin marked this pull request as draft July 15, 2023 14:23
@JanMarvin
Copy link
Owner Author

Cleaned the library quite a bit. Builds on Windows, Linux and Mac (on my local one at least), but C++20 is to much

@JanMarvin
Copy link
Owner Author

Another solution that actually works really well is https://github.com/herumi/msoffice.

It needs openssl as SystemRequirement and if linked with a static library, encoding and decoding is possible.

@JanMarvin JanMarvin closed this Jul 18, 2023
@JanMarvin JanMarvin deleted the encrypt branch July 18, 2023 13:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant