I have made a python script which is meant to read an excel spreadsheet and return the value of cell A39. I'm using the openpyxl library.
Here is the part of the code that is giving an error:
cFile = openpyxl.load_workbook('contacts.xlsx', read_only= True)
sheet = cFile.get_sheet_by_name('cSheet')
print sheet['A39'].value
Instead of printing the value of cell A39, which in the spreadsheet is "38", I get the following error:
File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/zipfile.py", line 971, in open
raise BadZipfile("Bad magic number for file header")
zipfile.BadZipfile: Bad magic number for file header
The spreadsheet 'contacts.xlsx' is not a zipped file. It is in the same folder as the python script. I made it with Excel 2011. Does anyone know why I'm getting this error or how I can fix it?
Thanks!