Berry Tsakala
Berry Tsakala

Reputation: 16660

Is there a programmatic way to read / open / decrypt Libreoffice ODS files (preferably python / bash)

I need to read, programmatically, data from a password-protected ODS (A Libreoffice Spreadsheet file). I know the password.

So far I tried:

  1. libreoffice command line. There isn't any libreoffice switch for passwords.
  2. pyexcel_ods3 (doesn't deal with passwords at all)
  3. openpyxl (doesn't open ODS)
  4. pandas_ods_reader (no password handling AFAIK)
  5. via libreoffice macro: I'm aware of this method, buy it doesn't suit my needs.

none of the tools I found even mention "password" in their code/docs.

Are there other ways to read / convert / open password-protected ODS files?

NOTES:

n.b. I know the password, I own the file, and I can open the file via GUI by entering the password manually.

This questions is NOT related to # 58705829 . That Q is confused, and probably asking about WRITING, not READING.

Upvotes: 2

Views: 1249

Answers (1)

David
David

Reputation: 186

Use unoconv to decrypt the files (though not the one from the Ubuntu repo, which is prior to this commit, and not from the FreeBSD packages, which also doesn't work out of the box).

Usage:

unoconv --password=$PASSWORD -d spreadsheet -f ods -o decrypted encrypted.ods

Which will create a decrypted.ods file.

Also works with encrypted xls/xlsx files.

Confirmed on an Ubuntu variant and also FreeBSD, using both the current github release and also the current pip package (unoconv-0.9.0).

Upvotes: 2

Related Questions