Error: “XLRDError: Excel xlsx file; not supported”
Environment Details
When using a python tool with pandas package, xlrd is unable to read .xlsx files, only .xls.
XLRD Error: Excel xlsx file; not supported
- Alteryx Designer
- Python Tool
Cause
xlrd 2.0.0 and above can only read .xls files. Support for .xlsx files was removed from xlrd due to a potential security vulnerability.
Resolution
Use openpyxl to open .xlsx files instead of xlrd.
- Install the openpyxl library on your cluster.
- Confirm that you are using pandas version 1.0.1 or above.
import pandas as pd
print(pd.__version__)
3. Specify openpyxl when reading .xlsx files with pandas.
import pandas
df = pandas.read_excel(`<name-of-file>.xlsx`, engine=`openpyxl`)
Additional Resources