Expand description
Python cells: the code a cell holds, its last result, and the text forms around it (the
PY("…",0|1) formula of the function’s syntax, and the xl("…") references inside it). An
xlsx file keeps the code in its Python part instead (see the xlsx crate).
Structs§
Constants§
- BLOCKED
- The value a Python cell shows when it can’t run:
#BLOCKED!. - FILE_
PREFIX - The prefix files put before
PY(, as Excel writes it ([MS-XLSX]:_xlfn._xlws.PY). - MAX_
FORMULA_ CHARS - Excel’s limit on the characters of one formula. A Python cell’s code must fit in it once it is
written as the PY formula of the function’s syntax (
PyCode::to_file_formula): quotes are doubled and every 255 characters add"&", so the limit on the code itself depends on what the code holds. - MAX_
RESULT_ CELLS - The most cells a Python result may have (a crafted file can claim any size).
Functions§
- is_
py_ formula - Whether
text(a formula, with or without=) is aPY(call: such formulas are Python cells, set withpython.set. - normalize_
code - Line breaks as
\n. - rewrite_
xl - Rewrites the reference of every
xl("…")literal incodewithf;Nonefromfleaves it. Returns the new code when anything changed. A new reference holding the literal’s quote (a sheet name that needs quotes,'Q4 2026'!B2) gets the other quote as its delimiter, or an escaped quote when it holds both, so it never ends the string early. - xl_
calls - The
xl(…)calls incode, skipping comments and other string literals. A call whose first argument isn’t a plain string literal has no reference: the cells it reads are only known when it runs.