Skip to content

Commit

Permalink
fix(python): Throw exception if dataset is too large for Excel
Browse files Browse the repository at this point in the history
  • Loading branch information
banflam committed Jan 24, 2025
1 parent 2722454 commit cdd74c1
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions py-polars/polars/dataframe/frame.py
Original file line number Diff line number Diff line change
Expand Up @@ -97,8 +97,8 @@
from polars.dependencies import pandas as pd
from polars.dependencies import pyarrow as pa
from polars.exceptions import (
InvalidOperationError,
ColumnNotFoundError,
InvalidOperationError,
ModuleUpgradeRequiredError,
NoRowsReturnedError,
TooManyRowsReturnedError,
Expand Down Expand Up @@ -3506,9 +3506,9 @@ def write_excel(
+ int(bool(column_totals)),
table_start[1] + len(df.columns) - 1,
)

excel_max_valid_rows = 1048575
if len(self.rows) > excel_max_valid_rows:
if self.height > excel_max_valid_rows:
msg = "Dataframe too large to be compatible with Excel. Exceeded Excel limit of 1048575 rows of data."
raise InvalidOperationError(msg)

Expand Down

0 comments on commit cdd74c1

Please sign in to comment.