#66372·pandas

BUG: `read_excel`: `ValueError: Length of new names must be 1, got 2`

Author: kuragaCreated Jul 19, 2026Updated Sep 29, 2026
LabelsBugIO Excel

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.

(Part of #34766.)

test.csv

test.xlsx

Image

Reproducible Example

python
import pandas as pd

df1 = pd.read_csv('test.csv', header=[0,1], index_col=0)
print(df1)

df2 = pd.read_excel('test.xlsx', header=[0,1], index_col=0, engine='openpyxl')
print(df2)

assert df1.equals(df2)

Issue Description

Empty DataFrame
Columns: []
Index: []
Traceback (most recent call last):
  File "<...>/venv/demo_suite/issue2/test.py", line 6, in <module>
    df2 = pd.read_excel('test.xlsx', header=[0,1], index_col=0, engine='openpyxl')
  File "<...>/venv/lib/python3.13/site-packages/pandas/io/excel/_base.py", line 494, in read_excel
    data = io.parse(
        sheet_name=sheet_name,
    ...<20 lines>...
        dtype_backend=dtype_backend,
    )
  File "<...>/venv/lib/python3.13/site-packages/pandas/io/excel/_base.py", line 1780, in parse
    return self._reader.parse(
           ~~~~~~~~~~~~~~~~~~^
        sheet_name=sheet_name,
        ^^^^^^^^^^^^^^^^^^^^^^
    ...<16 lines>...
        **kwds,
        ^^^^^^^
    )
    ^
  File "<...>/venv/lib/python3.13/site-packages/pandas/io/excel/_base.py", line 768, in parse
    output = self._parse_sheet(
        data=data,
    ...<19 lines>...
        **kwds,
    )
  File "<...>/venv/lib/python3.13/site-packages/pandas/io/excel/_base.py", line 950, in _parse_sheet
    raise err
  File "<...>/venv/lib/python3.13/site-packages/pandas/io/excel/_base.py", line 940, in _parse_sheet
    output[asheetname].columns = output[asheetname].columns.set_names(
                                 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^
        header_names
        ^^^^^^^^^^^^
    )
    ^
  File "<...>/venv/lib/python3.13/site-packages/pandas/core/indexes/base.py", line 2051, in set_names
    idx._set_names(names, level=level)
    ~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^
  File "<...>/venv/lib/python3.13/site-packages/pandas/core/indexes/base.py", line 1938, in _set_names
    raise ValueError(f"Length of new names must be 1, got {len(values)}")
ValueError: Length of new names must be 1, got 2 (sheet: 0)

Expected Behavior

No errors.

Installed Versions

INSTALLED VERSIONS

commit : 72f2fea91530b5abb3cf2100cb22d84e504695c0 python : 3.13.14 python-bits : 64 OS : Linux OS-release : 6.18.33-calculate Version : #1 SMP PREEMPT_DYNAMIC Tue Jun 9 10:00:56 UTC 2026 machine : x86_64 processor : Intel(R) Core(TM) i5-7200U CPU @ 2.50GHz byteorder : little LC_ALL : None LANG : ru_RU.UTF-8 LOCALE : ru_RU.UTF-8

pandas : 3.0.3 numpy : 2.5.1 dateutil : 2.9.0.post0 pip : 26.1.2 Cython : None sphinx : None IPython : None adbc-driver-postgresql: None adbc-driver-sqlite : None bs4 : None bottleneck : None fastparquet : None fsspec : None html5lib : None hypothesis : None gcsfs : None jinja2 : None lxml.etree : None matplotlib : None numba : None numexpr : None odfpy : None openpyxl : 3.1.5 psycopg2 : None pymysql : None pyarrow : None pyiceberg : None pyreadstat : None pytest : None python-calamine : None pytz : None pyxlsb : None s3fs : None scipy : None sqlalchemy : None tables : None tabulate : None xarray : None xlrd : None xlsxwriter : None zstandard : None qtpy : None pyqt5 : None