# 解析Excel文件:处理Excel xlsx file not supported错误 [特殊字符]

解析Excel文件:处理Excel xlsx file not supported错误 🧩

嘿,数据分析的小伙伴们!👋 我知道在处理Excel文件的时候,很多人可能会遇到这样一个错误:Excel xlsx file not supported。别担心,这篇文章会帮你理清这个错误产生的原因,并教你如何避免掉进这个坑!让我们开始吧!🚀

问题原因

这个错误通常与xlrd库的版本有关。从xlrd 1.2.0版本开始,这个库不再支持xlsx格式,只支持xls格式。如果你尝试用高版本的xlrd库来读取xlsx文件,就会报错。😅

解决方案

方法一:降低xlrd的版本

一个直接的解决方案是卸载新版本的xlrd并安装较旧版本,比如1.2.0或更早的版本。这种方法适合那些不方便更改文件格式的情况。

pip uninstall xlrd  # 先卸载现有版本
pip install xlrd==
Traceback (most recent call last): File "C: Users Idell AppData Local Programs Python Python3612. py”,line 3, inく module> df = pd. read_excel(r"C: \Usersldell\Downloads\第二章素材文件一实验项目二\第二 章素材文件一实验项目二\实验项目二\实验任务四\商品销售数据.xlsx”) File ”C: Users Idell lAppData Local lPrograms Python Python36lliblsite-packages lp andaslutill_decorators. py,line 296,in wrapper return func(*args, **kwargs) File”c: Users Ide ÍI AppData Local \Programs IPython Python36lliblsite-packages lp andasliolexcell_base. py”,line 304, in read_excel io = ExcelFile(io, engine=engine) File ”C: Usersldell AppData Local Programs lPython Python36 liblsite-packages lp andasliolexcell_base. py”,line 867, in _init_ self._reader = self._engines[engineT(self.Lio) File”C: Users Idell lAppData Local Programs lPython Python36lliblsite-packages Ip andasliolexcelLxlrd.py”,line 22, in _init__ super().__init_(filepath_or_buffer) File "C: Usersl deÏI lAppDataÏLocal \Programs Python Python36 liblsite-packageslp andasliolexcell_base. py”,line 353,in _init__ self. book = self. load_ workbook(filepath_or_buffer) File ”c: Users IdelI lAppÕata Local Programs lPython Python36lliblsite-packages Ip andasliolexcell_xlrd. py”, line 37, in load_workbook return open_workbook(filepath_or_buffer) File "C: lUsersldelI AppData Local lPrograms Python Python36\liblsite-packageslx lrdl init _.py, line i70, in open_workbook raise XIRDError (FILE_FORMAT_DESCRIPTIOIS[file_format]+'; not supported' ) xlrd. biffh. XLRDError: Excel xlsx file; not supported
最新发布
03-24
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值