We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
I have checked that this issue has not already been reported.
I have confirmed this bug exists on the latest version of pandas.
(optional) I have confirmed this bug exists on the master branch of pandas.
Note: Please read this guide detailing how to provide the necessary information for us to reproduce your bug.
writer = pd.ExcelWriter("test.xlsx", engine="openpyxl") pd.DataFrame().to_excel(writer, sheet_name="sheet", index=False) writer.save() pd.read_excel("test.xlsx", sheet_name="sheet") >> KeyError: 'Worksheet sheet does not exist.'
Executing DataFrame.to_excel() with sheet_name="sheet" creates an Excel with a sheet named "sheet1" instead of the requested name "sheet".
An Excel with a sheet named "sheet".
pd.show_versions()
commit : 9d598a5 python : 3.7.7.final.0 python-bits : 64 OS : Linux OS-release : 5.8.0-38-generic Version : #43~20.04.1-Ubuntu SMP Tue Jan 12 16:39:47 UTC 2021 machine : x86_64 processor : x86_64 byteorder : little LC_ALL : None LANG : es_ES.UTF-8 LOCALE : es_ES.UTF-8
pandas : 1.2.1 numpy : 1.19.5 pytz : 2020.5 dateutil : 2.8.1 pip : 20.3.3 setuptools : 41.2.0 Cython : None pytest : None hypothesis : None sphinx : None blosc : None feather : None xlsxwriter : None lxml.etree : None html5lib : None pymysql : None psycopg2 : None jinja2 : None IPython : None pandas_datareader: None bs4 : None bottleneck : None fsspec : None fastparquet : None gcsfs : None matplotlib : None numexpr : None odfpy : None openpyxl : 3.0.6 pandas_gbq : None pyarrow : None pyxlsb : None s3fs : None scipy : None sqlalchemy : None tables : None tabulate : None xarray : None xlrd : None xlwt : None numba : None
The text was updated successfully, but these errors were encountered:
This issue is exactly from openpyxl (engine) side.
If you use a different name for your sheet, openpyxl will create Excel with the requested name.
Sorry, something went wrong.
In this case, i'll check if this bug is already reported in openpyxl. If it's not reported, i will create a new issue there.
Thanks @izanbf1803. Please cross link the issue found or created in case other uses get here.
Since this is an upstream issue with openpyxl, closing.
No branches or pull requests
I have checked that this issue has not already been reported.
I have confirmed this bug exists on the latest version of pandas.
(optional) I have confirmed this bug exists on the master branch of pandas.
Note: Please read this guide detailing how to provide the necessary information for us to reproduce your bug.
Code Sample, a copy-pastable example
Problem description
Executing DataFrame.to_excel() with sheet_name="sheet" creates an Excel with a sheet named "sheet1" instead of the requested name "sheet".
Expected Output
An Excel with a sheet named "sheet".
Output of
pd.show_versions()
INSTALLED VERSIONS
commit : 9d598a5
python : 3.7.7.final.0
python-bits : 64
OS : Linux
OS-release : 5.8.0-38-generic
Version : #43~20.04.1-Ubuntu SMP Tue Jan 12 16:39:47 UTC 2021
machine : x86_64
processor : x86_64
byteorder : little
LC_ALL : None
LANG : es_ES.UTF-8
LOCALE : es_ES.UTF-8
pandas : 1.2.1
numpy : 1.19.5
pytz : 2020.5
dateutil : 2.8.1
pip : 20.3.3
setuptools : 41.2.0
Cython : None
pytest : None
hypothesis : None
sphinx : None
blosc : None
feather : None
xlsxwriter : None
lxml.etree : None
html5lib : None
pymysql : None
psycopg2 : None
jinja2 : None
IPython : None
pandas_datareader: None
bs4 : None
bottleneck : None
fsspec : None
fastparquet : None
gcsfs : None
matplotlib : None
numexpr : None
odfpy : None
openpyxl : 3.0.6
pandas_gbq : None
pyarrow : None
pyxlsb : None
s3fs : None
scipy : None
sqlalchemy : None
tables : None
tabulate : None
xarray : None
xlrd : None
xlwt : None
numba : None
The text was updated successfully, but these errors were encountered: