. Advertisement .
..3..
. Advertisement .
..4..
You may encounter the xlrd.Biffh.XLRDError: Excel xlsx file; not supported in Python. The following blog post will explain how to fix it. Make sure to stay tuned for some solutions about it.
What Is The xlrd.biffh.XLRDError: Excel xlsx file; not supported in python
When you start to access a macro-enabled excel spreadsheet with pandas.read excel and the xlrd library, you will get the error below.
2020-12-12T21:09:53.441+05:30 [APP/PROC/WEB/0] [ERR] df1=pd.read_excel(os.path.join(APP_PATH, os.path.join("Data", "aug_latest.xlsm")),sheet_name=None)
2020-12-12T21:09:53.441+05:30 [APP/PROC/WEB/0] [ERR] return open_workbook(filepath_or_buffer)
2020-12-12T21:09:53.441+05:30 [APP/PROC/WEB/0] [ERR] File "/home/vcap/deps/0/python/lib/python3.8/site-packages/xlrd/__init__.py", line 170, in open_workbook
2020-12-12T21:09:53.441+05:30 [APP/PROC/WEB/0] [ERR] raise XLRDError(FILE_FORMAT_DESCRIPTIONS[file_format]+'; not supported')
2020-12-12T21:09:53.441+05:30 [APP/PROC/WEB/0] [ERR] xlrd.biffh.XLRDError: Excel xlsx file; not supported
The Solutions
The most recent variant of xlrd only accepts .xls files. You will be able to open the documents by installing the previous 1.2.0 version. Here are some possible solutions to the problem.
Solution 1
Download the previous 1.2.0 version to have access to the .xlsx documents.
Solution 2
As mentioned, the most recent 2.0.1 version accepts only .xls documents. If you’re willing to take the chance on potential security threats and inaccurate document parsing, you may resolve this problem by downloading an earlier variant.
Please type the following command to fix it.
pip install xlrd==1.2.0
Solution 3
The third solution focuses on the potential security flaws associated with using a 1.2 or older version to read .xlsx files. Enter these lines of command to resolve it.
Install openpyxl by visiting https://openpyxl.readthedocs.io/en/stable/.
Make the following changes to the pandas’ code:
pandas.read_excel('cat.xlsx', engine='openpyxl')
Conclusion
We believe the above solutions on solving the xlrd.Biffh.XLRDError: Excel xlsx file; not supported in Python should benefit your needs. Leave your ideas and questions in the comments section below.
Thank you for your time!
Leave a comment