Python无法打开.xlsx文件:xlrd.biffh.XLRDError: Excel xlsx file; not supported

时间: 2023-07-29 admin 互联网

Python无法打开.xlsx文件:xlrd.biffh.XLRDError: Excel xlsx file; not supported

Python无法打开.xlsx文件:xlrd.biffh.XLRDError: Excel xlsx file; not supported

Python无法打开.xlsx文件:xlrd.biffh.XLRDError: Excel xlsx file; not supported

原因是Python中xlrd模块 2.0.1 版本不支持.xlsx

解决方案1.

  1. 卸载已安装的xlrd-2.0.1,安装低版本的xlrd-1.2.0

    pip uninstall xlrd
    
    pip install xlrd==1.2.0
    

解决方案2.

  1. test.xlsx文件另存为xls 文件

    注意不能直接修改test.xlsx文件的后缀名,不然还是读取不出来

今天学会了个新技能其实有时候报错,可以先查源码

在查官方文档
官网说明

xlrd 2.0.1 版本

xlrd 1.2.0 版本