diff --git a/pandas/io/excel.py b/pandas/io/excel.py index a7e0e48de0a75..2b964a88a9695 100644 --- a/pandas/io/excel.py +++ b/pandas/io/excel.py @@ -651,6 +651,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, @@ -671,9 +672,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)