.xlsm spread sheet returns errors
Created originally on Bitbucket by sumantw (S R)
I have a complex excel spreadsheet and I have the following python script
#!python
w = px.load_workbook('file1.xlsm', data_only=True)
p = w.get_sheet_by_name(name = 'forecasting')
a = p.cell('J11').value
b = p.cell('J12').value
print a
print b
and when it runs it throws up the following error
#!python
Traceback (most recent call last):
File "Test2.py", line 5, in <module>
w = px.load_workbook('file1.xlsm', data_only=True)
File "C:\Python27\lib\site-packages\openpyxl\reader\excel.py", line 152, in load_workbook
raise InvalidFileException(unicode(e))
openpyxl.utils.exceptions.InvalidFileException: ''
If it is of any help. the file throws up the following error when i use xlrd
#!python
Traceback (most recent call last):
File "Test1.py", line 5, in <module>
book = xlrd.open_workbook("file1.xlsm")
File "C:\Python27\lib\site-packages\xlrd\__init__.py", line 422, in open_workbook
ragged_rows=ragged_rows,
File "C:\Python27\lib\site-packages\xlrd\xlsx.py", line 765, in open_workbook_2007_xml
x12book.process_stream(zflo, 'Workbook')
File "C:\Python27\lib\site-packages\xlrd\xlsx.py", line 254, in process_stream
meth(self, elem)
File "C:\Python27\lib\site-packages\xlrd\xlsx.py", line 359, in do_sheet
reltype = self.relid2reltype[rid]
KeyError: ''
Can you please let me know how to solve the issue?