Skip to content

BUG: pd.read_excel is unexpectedly printing sheet_names to stdout #51865

@devmcp

Description

@devmcp

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

df = pd.read_excel("test.xlsx")

Issue Description

df = pd.read_excel("test.xlsx")

Is working as expected in that df is correct, but it is printing to screen a subset of the sheet names contained in "test.xlsx". e.g.

mysheetname 3
mysheetname 4

If, in Excel, I delete the entire contents of mysheetname 3 its name is still printed out when running read_excel. If I delete the worksheet, then create a new one with the same name, it no longer is printed to screen. So presumably these sheets contain something weird that is causing read_excel to print the sheet name to screen.

Expected Behavior

df = pd.read_excel("test.xlsx")

does not print to screen a subset of the sheet names in my workbook.

Installed Versions

Details

INSTALLED VERSIONS

commit : 2e218d1
python : 3.10.9.final.0
python-bits : 64
OS : Windows
OS-release : 10
Version : 10.0.22621
machine : AMD64
processor : Intel64 Family 6 Model 165 Stepping 2, GenuineIntel
byteorder : little
LC_ALL : None
LANG : None
LOCALE : English_United Kingdom.1252
pandas : 1.5.3
numpy : 1.24.2
pytz : 2022.7.1
dateutil : 2.8.2
setuptools : 67.2.0
pip : 22.3.1
Cython : None
pytest : 7.2.1
hypothesis : None
sphinx : None
blosc : None
feather : None
xlsxwriter : None
lxml.etree : None
html5lib : None
pymysql : None
psycopg2 : None
jinja2 : 3.1.2
IPython : 8.10.0
pandas_datareader: None
bs4 : 4.11.2
bottleneck : None
brotli : None
fastparquet : None
fsspec : None
gcsfs : None
matplotlib : None
numba : None
numexpr : None
odfpy : None
openpyxl : 3.1.0
pandas_gbq : None
pyarrow : None
pyreadstat : None
pyxlsb : None
s3fs : None
scipy : None
snappy : None
sqlalchemy : None
tables : None
tabulate : None
xarray : None
xlrd : None
xlwt : None
zstandard : None
tzdata : None

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions