I was doing some testing of pandas and saved the same file as an XLSX and an XLS file for unit testing. On Windows, I use Excel 2013. I need the XLS file to test Pandas.
I then use Excel 2013 to save the file as an XLS file (so that I can test it with pandas unit testing). That file is attached as xlrdtest.xls . That file fails to read in with xlrd:
>>> wk = xlrd.open_workbook("xlrdtest.xls")
*** formula/tFunc unknown FuncID:186
*** formula/tFunc unknown FuncID:186
*** formula/tFunc unknown FuncID:186
*** formula/tFunc unknown FuncID:186
*** formula/tFunc unknown FuncID:186
*** formula/tFunc unknown FuncID:186
Traceback (most recent call last):
File "C:\Anaconda3\lib\site-packages\IPython\core\interactiveshell.py", line 3035, in run_code
exec(code_obj, self.user_global_ns, self.user_ns)
File "<ipython-input-16-eb22c9b75a70>", line 1, in <module>
wk = xlrd.open_workbook("xlrdtest.xls")
File "C:\Anaconda3\lib\site-packages\xlrd\__init__.py", line 435, in open_workbook
ragged_rows=ragged_rows,
File "C:\Anaconda3\lib\site-packages\xlrd\book.py", line 116, in open_workbook_xls
bk.parse_globals()
File "C:\Anaconda3\lib\site-packages\xlrd\book.py", line 1198, in parse_globals
self.names_epilogue()
File "C:\Anaconda3\lib\site-packages\xlrd\book.py", line 997, in names_epilogue
evaluate_name_formula(self, nobj, namex, blah=blah)
File "C:\Anaconda3\lib\site-packages\xlrd\formula.py", line 1125, in evaluate_name_formula
assert len(tgtobj.stack) == 1
AssertionError
I then transfer the XLSX file xlrdtest.xlsx to a Mac, and use Excel Mac 2011 to read in that file and save it as an XLS file. That is attached as xlrdtestMac.xls. That file reads in fine with xlrd.
So it seems the problem is with how the Windows version of Excel is saving the file.
Note that it is the presence of multiple worksheets that seems to trigger the exception. If the original XLSX file has one sheet, then the Excel 2013 saved XLS file reads in fine.