diff --git a/pandas/io/excel/_openpyxl.py b/pandas/io/excel/_openpyxl.py index 3a753a707166e..6ebb04eb19534 100644 --- a/pandas/io/excel/_openpyxl.py +++ b/pandas/io/excel/_openpyxl.py @@ -509,24 +509,14 @@ def get_sheet_by_index(self, index: int): def _convert_cell(self, cell, convert_float: bool) -> Scalar: - from openpyxl.cell.cell import TYPE_BOOL, TYPE_ERROR, TYPE_NUMERIC + from openpyxl.cell.cell import TYPE_ERROR, TYPE_NUMERIC if cell.value is None: return "" # compat with xlrd - elif cell.is_date: - return cell.value elif cell.data_type == TYPE_ERROR: return np.nan - elif cell.data_type == TYPE_BOOL: - return bool(cell.value) - elif cell.data_type == TYPE_NUMERIC: - # GH5394 - if convert_float: - val = int(cell.value) - if val == cell.value: - return val - else: - return float(cell.value) + elif not convert_float and cell.data_type == TYPE_NUMERIC: + return float(cell.value) return cell.value