Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion pandas/io/excel/_base.py
Original file line number Diff line number Diff line change
Expand Up @@ -1327,7 +1327,8 @@ def _value_with_fmt(
# xref https://support.microsoft.com/en-au/office/excel-specifications-and-limits-1672b34d-7043-467e-8e27-269d656771c3
if len(val) > 32767:
warnings.warn(
"Cell contents too long, truncated to 32767 characters",
f"Cell contents too long ({len(val)}), "
"truncated to 32767 characters",
UserWarning,
stacklevel=find_stack_level(),
)
Expand Down
2 changes: 1 addition & 1 deletion pandas/tests/io/excel/test_writers.py
Original file line number Diff line number Diff line change
Expand Up @@ -1390,7 +1390,7 @@ def test_to_excel_empty_frame(self, engine, tmp_excel):
def test_to_excel_raising_warning_when_cell_character_exceed_limit(self):
# GH#56954
df = DataFrame({"A": ["a" * 32768]})
msg = "Cell contents too long, truncated to 32767 characters"
msg = r"Cell contents too long \(32768\), truncated to 32767 characters"
with tm.assert_produces_warning(
UserWarning, match=msg, raise_on_extra_warnings=False
):
Expand Down