Reputation: 9
I want to read Protected view excel(xls) file in python. I am currently using "xlrd.open_workbook" but it is giving error as work book is encrypted.
There is no password present in the file.
Can any one help to with the same.
Upvotes: 0
Views: 1194
Reputation: 83
You can use the openpyxl Python Library to operate with (and open) Excel files. I don’t believe opening a Excel file, that has a password, is supported in OpenPyxl. That is, you can’t open the file! However this sounds in contradiction to what you can do in openpyxl. You can, apparently, set the password. This implies you can then, subsequently, open the file using the password you just created.
Here is some code to help. The 3rd line is setting the password. So the code, below, would need to be modified. And I have only used Python on Windows systems not Linux.
import openpyxl
wb = openpyxl.load_workbook('Pxl.xlsx')
wb.security.workbookPassword = 'thepassword'
Upvotes: 1