Working with password protected Excel worksheets in Python on Linux

The problem is pretty simple. Every week I get a bunch of password protected excel files. I need to parse them and write some parts to a new file using Python. I am given a password for the files.

It was easy to handle when done on Windows, and I could just import win32com and use client.Dispatch. But now we are translating all our code to linux, so win32com is no longer for me.

Is there a way to open and read data from a password protected excel sheet in python on linux?

I was looking for an easy way to open a password protected excel file, but no luck. I also tried to find a way to simply remove the password protection, so I can use xlrd as if I were in a file that is not password protected but not lucky in this route.

Any help would be greatly appreciated.

+4
source share
1 answer

with libraofficeandunoconv

unoconv -p p4ssw0rd -f csv  protectedFile.xls

and then parse the file csv. Or export to another xls if you need formatting or want to torture yourself

+2
source

Source: https://habr.com/ru/post/1569328/


All Articles