Skip to content

BUG: ExcelWriter.book - attribute not accessible for setting #48780

Closed
@vranoch

Description

@vranoch

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

import pandas as pd

wb = load_workbook(self._get_report_filename_template())
wb.create_sheet(self.report_range_sheet)
with pd.ExcelWriter(file, engine='openpyxl') as writer:
	writer.book = wb  # This assignment causes AttributeError: can't set attribute

Issue Description

Assignment to writer.book causes an exception:

Traceback (most recent call last): File "/app/py_code/Bussiness/Reports/PrehledovyReport.py", line 108, in _export_data writer.book = wb AttributeError: can't set attribute

downgrading to 1.4.4 resolves the issue

Expected Behavior

The assignment should work - injecting externally created workbook to the writer

Installed Versions

pd.show_versions() returns None ... presenting the requirements.txt instead

amqp==5.1.1
asgiref==3.5.2
astroid==2.12.10
asttokens==2.0.8
async-timeout==4.0.2
backports.zoneinfo==0.2.1
beautifulsoup4==4.11.1
billiard==3.6.4.0
bs4==0.0.1
celery==5.2.7
certifi==2022.9.14
chardet==5.0.0
charset-normalizer==2.1.1
click==8.1.3
click-didyoumean==0.3.0
click-plugins==1.1.1
click-repl==0.2.0
colorama==0.4.5
convertdate==2.4.0
DateTime==4.7
decorator==5.1.1
Deprecated==1.2.13
dill==0.3.5.1
Django==4.1.1
django-admin-rangefilter==0.8.8
django-appconf==1.0.5
django-celery-results==2.4.0
django-compat==1.0.15
django-debug-toolbar==3.6.0
django-imagekit==4.1.0
django-pandas==0.6.6
django-request-logging==0.7.5
django-sendgrid-v5==1.2.1
et-xmlfile==1.1.0
future==0.18.2
geocoder==1.38.1
greenlet==1.1.3
icontract==2.6.2
idna==3.4
isort==5.10.1
jdcal==1.4.1
Jinja2==3.1.2
jplephem==2.17
kombu==5.2.4
lazy-object-proxy==1.7.1
lunardate==0.2.0
MarkupSafe==2.1.1
mccabe==0.7.0
numpy==1.23.3
openpyxl==3.0.10
packaging==21.3
pandas==1.5.0
pilkit==2.0
Pillow==9.2.0
platformdirs==2.5.2
prompt-toolkit==3.0.31
psycopg2==2.9.3
pyCalverter==1.6.1
pylint==2.15.3
pylint-django==2.5.3
pylint-plugin-utils==0.7
pylint-unittest==0.1.3
pyluach==2.0.1
PyMeeus==0.5.11
pyparsing==3.0.9
pypng==0.20220715.0
PyQRCode==1.2.1
python-dateutil==2.8.2
python-http-client==3.3.7
pytz==2022.2.1
PyYAML==6.0
ratelim==0.1.6
redis==4.3.4
requests==2.28.1
sendgrid==6.9.7
sgp4==2.21
six==1.16.0
skyfield==1.45
skyfield-data==4.0.0
soupsieve==2.3.2.post1
SQLAlchemy==1.4.40
sqlparse==0.4.2
starkbank-ecdsa==2.0.3
toml==0.10.2
tomli==2.0.1
tomlkit==0.11.4
typing_extensions==4.3.0
tzdata==2022.2
urllib3==1.26.12
vine==5.0.0
wcwidth==0.2.5
workalendar==16.4.0
wrapt==1.14.1
zope.interface==5.4.0

Metadata

Metadata

Assignees

No one assigned

    Labels

    IO Excelread_excel, to_excelRegressionFunctionality that used to work in a prior pandas version

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions