Anas GOURZI
Anas GOURZI

Reputation: 1

The ERROR: xlrd.biffh.XLRDError: Excel xlsx file; not supported

Please I'd like to ask you a question about opening an excel file. Now I'm trying to open it using this program:

data = pd.read_excel(r'C:\Users\Acer\Desktop\OffshoringData.xlsx')
print(data)

The problem is that I found the following error:

**xlrd.biffh.XLRDError: Excel xlsx file; not supported**

What should I do in this case, please??

Upvotes: 0

Views: 6394

Answers (2)

Timothy Munyao
Timothy Munyao

Reputation: 19

This error is usually as a result of conflicting versions of the xlrd package and your excel version. Try installing a newer version of xlrd package (v2.0.1) which is able to handle .xlsx files. Seems the version of xlrd you are using is for older versions of excel files.

reference - xlrd python package

Upvotes: -2

user14518362
user14518362

Reputation: 330

You need to use a different engine in your pandas.read_excel().

For security reasons xlrd no longer supports .xlsx files, but openpyxl still does.

So you would need to add engine='openpyxl' in your function.

Here's the documentation: https://pandas.pydata.org/docs/reference/api/pandas.read_excel.html

Upvotes: 2

Related Questions