diff --git a/pandas/io/excel.py b/pandas/io/excel.py index 3ce8953a6edb2d..141d2c79a1927b 100644 --- a/pandas/io/excel.py +++ b/pandas/io/excel.py @@ -660,6 +660,7 @@ def _parse_cell(cell_contents, cell_typ): # GH 12292 : error when read one empty column from excel file try: parser = TextParser(data, + names=names, header=header, index_col=index_col, has_index_names=has_index_names, @@ -681,9 +682,6 @@ def _parse_cell(cell_contents, cell_typ): output[asheetname] = parser.read(nrows=nrows) - if names is not None: - output[asheetname].columns = names - if not squeeze or isinstance(output[asheetname], DataFrame): output[asheetname].columns = output[ asheetname].columns.set_names(header_names)