Welcome to the Alteryx Knowledge Base

Python Error: XLRDError: Excel xlsx file; not supported
user

Created/Edited - 12/6/2024 by London Hanson | Alteryx

Summary
When using a python tool with pandas package, xlrd is unable to read .xlsx files, only .xls.
Environment

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

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

 

Resolution

Use openpyxl to open .xlsx files instead of xlrd.
  1. Install the openpyxl library on your cluster.
  2. 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 Information
Was this article helpful?