XLRDError: Excel xlsx file; not supported解决

Posted pythonic生物人

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了XLRDError: Excel xlsx file; not supported解决相关的知识,希望对你有一定的参考价值。

使用xlrd读取excel文件代码如下:

import xlrd
filename='./xxxx.xlsx'
data = xlrd.open_workbook(filename)

报错如下:

---------------------------------------------------------------------------
XLRDError                                 Traceback (most recent call last)
<ipython-input-7-7a969c306a8d> in <module>
      1 import xlrd
      2 filename='./xxxx.xlsx'
----> 3 data = xlrd.open_workbook(filename)

~/anaconda/anaconda3/lib/python3.8/site-packages/xlrd/__init__.py in open_workbook(filename, logfile, verbosity, use_mmap, file_contents, encoding_override, formatting_info, on_demand, ragged_rows, ignore_workbook_corruption)
    168     # files that xlrd can parse don't start with the expected signature.
    169     if file_format and file_format != 'xls':
--> 170         raise XLRDError(FILE_FORMAT_DESCRIPTIONS[file_format]+'; not supported')
    171 
    172     bk = open_workbook_xls(

XLRDError: Excel xlsx file; not supported

报错原因:

网上搜了下,主要是xlrd版本兼容的问题

解决方法:重新安装xlrd指定版本号

pip install xlrd==1.2.0

重新读取成功

 

以上是关于XLRDError: Excel xlsx file; not supported解决的主要内容,如果未能解决你的问题,请参考以下文章

XLRDError: Excel xlsx file; not supported

python3 使用 xlrd 库操作 excel.xlsx 时,报错: xlrd.biffh.XLRDError: Excel xlsx file; not supported

python3 使用 xlrd 库操作 excel.xlsx 时,报错: xlrd.biffh.XLRDError: Excel xlsx file; not supported

读取xlsx文件错误:xlrd.biffh.XLRDError: Excel xlsx file; not supported

XLRDError: Excel xlsx file; not supported 报错解决方法

XLRDError: Excel xlsx file; not supported 报错解决方法