We have extended our Early Bird Tickets for Inspire 2023! Discounted pricing goes until February 24th. Save your spot!

Alteryx Designer Knowledge Base

Definitive answers from Designer experts.

Python Error: XLRDError: Excel xlsx file; not supported

londonhanson
Alteryx
Alteryx
Created

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.
  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 Resources