I have a directory of files that I want to use the xlrd module in Python to loop through and read values out of. There are several worksheets in each file and some of them are hidden and password protected. The worksheet that I need to pull values off of is not protected. However, I get the error: xlrd.biffh.XLRDError: Workbook is encrypted indicating that the file is protected.
Any idea how to open the files and only read the unencrypted/password free worksheets?
I am only beginning so my code is still a little rough:
for root, dirs, files in os.walk("O:\MIS\Reporting\w_code", topdown=True):
for name in files:
InputFile = os.path.join(root, name)
wbk = xlrd.open_workbook(InputFile,)
sht = wbk.sheet_by_index(0)
print sht
sheet=workbook.sheet_by_index(0)
variable = sheet.cell_value(2,10)
Thank you in advance.
As of 2009, this functionality was 'unlikely to be implemented'
http://www.lexicon.net/sjmachin/README.html
Maybe more of an xlrd expert can say whether this has been done. I vaguely remember needing to do something like this in the past and struggling.
This link suggests an alternative
https://mail.python.org/pipermail/python-list/2009-January/519615.html