Hello Guys How are you all ? Hope you all are fine. I am trying to read macro enabled excel work sheet using pandas.read_excel
with xlrd library. But I am facing xlrd.biffh.XLRDError: Excel xlsx file; not supported this error.
So here I am come with all possible solution .
What is Error
When you try to read macro enabled excel work sheet using pandas.read_excel
with xlrd library its through error like 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
Solutions
The latest version of xlrd(2.01) only supports .xls files. Installing the older version 1.2.0 worked for me to open .xlsx files.
Solution 1
- Installing the older version, 1.2.0, worked for me to open .xlsx files.
Solution 2
- The latest version of xlrd (2.0.1) only supports .xls files.
- If you are prepared to risk potential security vulnerabilities, and risk incorrect parsing of certain files, this error can be solved by installing an older version of xlrd.
- Use the command below in a shell or cmd prompt:
pip install xlrd==1.2.0
Solution 3
This is due to potential security vulnerabilities relating to the use of xlrd version 1.2 or earlier for reading .xlsx files.
In your case, the solution is to:
- install openpyxl: https://openpyxl.readthedocs.io/en/stable/
- change your pandas code to be:
pandas.read_excel(‘cat.xlsx’, engine=’openpyxl’)
So Hope This Above 3 Solution Will Work For You Too. So it’s all About xlrd.biffh.XLRDError: Excel xlsx file; not supported error. Hope this tutorial helped you a lot. Comment below Your thoughts and your queries. And Also Comment on your suggestion here.
Thank you for sharing this.
This is amazing, thank you for sharing this!!