ENH: Auto Detect engine in read_excel · Issue #35416 · pandas-dev/pandas (original) (raw)


Note: Please read this guide detailing how to provide the necessary information for us to reproduce your bug.

Code Sample, a copy-pastable example

This works:

import pandas as pd df = pd.read_excel('Book2.xlsb', engine='pyxlsb')

This doesn't:

import pandas as pd df = pd.read_excel('Book2.xlsb')

Problem description

All supported Excel formats (xls, xlsx, xlsm) have a default engine based on the extension, so you can simply do:

df = pd.read_excel('Book2.xlsx')

For xlsb, when you do df = pd.read_excel('Book2.xlsb'), you get this error:

XLRDError: Excel 2007 xlsb file; not supported

Expected Output

No error, i.e. it should figure out that for xlsb extensions, pyxlsb is the default engine.

Output of pd.show_versions()

INSTALLED VERSIONS

commit : None

pandas : 1.0.5
numpy : 1.18.1
pytz : 2020.1
dateutil : 2.8.1
pip : 20.0.2
setuptools : 49.2.0.post20200714
Cython : None
pytest : 5.4.3
hypothesis : None
sphinx : 2.4.0
blosc : None
feather : None
xlsxwriter : 1.2.7
lxml.etree : None
html5lib : None
pymysql : None
psycopg2 : None
jinja2 : 2.11.2
IPython : 7.16.1
pandas_datareader: None
bs4 : None
bottleneck : None
fastparquet : None
gcsfs : None
lxml.etree : None
matplotlib : 3.1.3
numexpr : None
odfpy : None
openpyxl : 3.0.4
pandas_gbq : None
pyarrow : 0.17.1
pytables : None
pytest : 5.4.3
pyxlsb : 1.0.6
s3fs : None
scipy : 1.4.1
sqlalchemy : None
tables : None
tabulate : 0.8.7
xarray : None
xlrd : 1.2.0
xlwt : 1.3.0
xlsxwriter : 1.2.7
numba : None