Python打开Excel报错:
1.报错:raise XLRDError(FILE_FORMAT_DESCRIPTIONS[file_format]+‘; not supported’)
Traceback (most recent call last):
File “SplitLanguageFile.py”, line 90, in
CopyAllFile(path_language, path_languageSplit)
File “SplitLanguageFile.py”, line 80, in CopyAllFile
CopyFile(_from, _to, f)
File “SplitLanguageFile.py”, line 26, in CopyFile
excel_1 = xlrd.open_workbook(fp_from, “utf-8”)
File “/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/xlrd/init.py”, line 170, in open_workbook
raise XLRDError(FILE_FORMAT_DESCRIPTIONS[file_format]+‘; not supported’)
xlrd.biffh.XLRDError: Excel xlsx file; not supported
2.查看当前xlrd版本
pip2 show xlrd
显示:
3.报错原因:xlrd版本过高
4.解决方式:降低xlrd版本
pip2 install xlrd==1.2.0
脚本成功运行,问题解决。