Skip to content

Commit e7476d3

Browse files
Geronimo BergkGeronimo Bergk
authored andcommitted
more descriptive note on excel formula treatment
1 parent 5b0b12c commit e7476d3

File tree

1 file changed

+11
-5
lines changed

1 file changed

+11
-5
lines changed

pandas/core/generic.py

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2252,11 +2252,17 @@ def to_excel(
22522252
and cell character count does not exceed Excel's limitations.
22532253
All other limitations must be checked by the user.
22542254
2255-
Excel treats any cell starting with `=` as a formula, which can pose security
2256-
risks. To store such content as plain text, prepend an apostrophe (`'`), e.g.,
2257-
change `"=foobar"` to `"'=foobar"`. For `xlsxwriter`, you can use
2258-
`engine_kwargs={"options": {"strings_to_formulas": False}}` to disable formula
2259-
interpretation without prepending an apostrophe.
2255+
Excel treats any cell starting with ``=`` as a formula, which can pose security
2256+
risks. To store such content as plain text, you can either:
2257+
2258+
* Prepend an apostrophe to the value, e.g. ``"'=foobar"``
2259+
* For ``xlsxwriter``, disable formula interpretation:
2260+
2261+
.. code-block:: python
2262+
2263+
df.to_excel(
2264+
"path.xlsx", engine_kwargs={"options": {"strings_to_formulas": False}}
2265+
)
22602266
22612267
Examples
22622268
--------

0 commit comments

Comments
 (0)