diff --git a/py-polars/polars/dataframe/frame.py b/py-polars/polars/dataframe/frame.py index ae1a9260bf65..3a47af443eb3 100644 --- a/py-polars/polars/dataframe/frame.py +++ b/py-polars/polars/dataframe/frame.py @@ -3188,6 +3188,7 @@ def write_excel( *table_start, *table_finish, { + "data": df.rows(), "style": table_style, "columns": table_columns, "header_row": include_header, @@ -3198,18 +3199,6 @@ def write_excel( }, ) - # write data into the table range, column-wise - if not is_empty: - column_start = [table_start[0] + int(include_header), table_start[1]] - for c in df.columns: - if c in self.columns: - ws.write_column( - *column_start, - data=df[c].to_list(), - cell_format=column_formats.get(c), - ) - column_start[1] += 1 - # apply conditional formats if conditional_formats: _xl_apply_conditional_formats( @@ -3244,8 +3233,6 @@ def write_excel( None, options, ) - elif options: - ws.set_column(col_idx, col_idx, None, None, options) # finally, inject any sparklines into the table for column, params in (sparklines or {}).items():