You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Since openpyxl 3.1.1, the code given above results in the following error:
Failed to process file: 'ReadOnlyWorksheet' object has no attribute 'defined_names'
Downgrading to openpyxl 3.1.0 fixes this issue. From the outside, it is not clear whether pandas or openpyxl needs to be fixed, even though it looks like a bug on openpyxl side. It is likely related to this issue which was marked as fixed in openpyxl 3.1.1: https://foss.heptapod.net/openpyxl/openpyxl/-/issues/1947
Pandas version checks
I have checked that this issue has not already been reported.
I have confirmed this bug exists on the latest version of pandas.
I have confirmed this bug exists on the main branch of pandas.
Reproducible Example
Issue Description
Since openpyxl 3.1.1, the code given above results in the following error:
Downgrading to openpyxl 3.1.0 fixes this issue. From the outside, it is not clear whether pandas or openpyxl needs to be fixed, even though it looks like a bug on openpyxl side. It is likely related to this issue which was marked as fixed in openpyxl 3.1.1: https://foss.heptapod.net/openpyxl/openpyxl/-/issues/1947
Link to openpyxl changelog: https://openpyxl.readthedocs.io/en/stable/changes.html#id1
There is also a report on StackOverflow which has already gotten more than 4000 views: https://stackoverflow.com/questions/75440354/why-does-pandas-read-excel-fail-on-an-openpyxl-error-saying-readonlyworksheet
Expected Behavior
reading a file works just like with openpyxl 3.1.0
Installed Versions
pandas : 1.5.3
numpy : 1.24.2
pytz : 2020.5
dateutil : 2.8.2
setuptools : 67.3.3
pip : 22.3.1
Cython : None
pytest : 7.2.1
hypothesis : None
sphinx : None
blosc : None
feather : None
xlsxwriter : None
lxml.etree : None
html5lib : 1.1
pymysql : None
psycopg2 : 2.9.5
jinja2 : 3.1.2
IPython : None
pandas_datareader: None
bs4 : None
bottleneck : None
brotli : None
fastparquet : None
fsspec : None
gcsfs : None
matplotlib : None
numba : None
numexpr : None
odfpy : None
openpyxl : None
pandas_gbq : None
pyarrow : None
pyreadstat : None
pyxlsb : None
s3fs : None
scipy : None
snappy : None
sqlalchemy : 1.4.46
tables : None
tabulate : None
xarray : None
xlrd : None
xlwt : None
zstandard : None
tzdata : None
The text was updated successfully, but these errors were encountered: