Apply value edits to cell, paragraph, or equation targets, or apply a structural edit. Within the batching limits and separation rules in this description, group compatible edits into one call whenever possible; per-call fixed overhead dominates, so splitting the same work across individual calls costs substantially more. Select with targetHandle, structuralCoord, or an opaque anchor. Anchor-only selection needs no structureVersion: an anchor remains valid while the session is alive and survives this service's structural edits. When targetHandle, structuralCoord, and/or anchor are supplied together, every supplied selector is cross-validated and a mismatch is rejected. If a uniquely resolved anchor is supplied with a stale targetHandle, the stale handle is ignored, the edit proceeds by anchor, and warnings includes stale-handle-ignored; valid conflicting selectors are still rejected. When using structuralCoord without targetHandle or anchor, pass sibling structureVersion equal to N from a targetHandle shaped v<N>:<index> in the same list_targets result; a missing or stale coordinate version is rejected with stale-coord, and the caller must call list_targets again. Before a whole-value cell or paragraph edit, require list_targets fillable=true; otherwise inspect fillBlockedReason. For a recognized placeholder cell, use a whole-cell value edit; paragraph- or run-addressed value edits leave example styling behind. A cell paragraph's listed anchor with value replaces only that paragraph; adding a listed runIndex replaces only that run in the anchored paragraph. This differs from selecting the same cell by its cell targetHandle with value, which keeps the existing whole-cell replacement meaning. For run-addressed edits, inspect runOps and runs[].removable. For a cell or paragraph, pass runIndex with value to replace one listed run, runIndex with setCharStyle to assign it to an existing style, runIndex with setCharStyleDelta to apply bold/italic/textColor (creating one only if no equivalent exists), runIndex with splitAt (a UTF-16 offset inside the run) and optional secondCharStyle to split it into two adjacent runs using existing document styles, or operation removeRun with runIndex to remove the whole addressed run. removeRun accepts only a run containing one text item and nothing else and refuses the last run in its paragraph; use removeParagraph for the whole line. For a cell, pass operation cloneParagraph or removeParagraph with one listed paragraphIndex, or pass operation addParagraph only when that paragraph has addSourceEligible=true, with paragraphIndex plus value to clone a listed one-text-item source paragraph and replace the clone text atomically; value must contain the complete new paragraph text including its marker. A cell paragraph anchor selects its current parent cell and paragraphIndex. addParagraph rejects multi-run, equation, field, or paragraphs paired with objects. For those paragraphs use cloneParagraph, call list_targets again, identify the new paragraph's runs by runs[].paragraphIndex, then edit individual text runs and equation targets; equation values follow valueContract=latex and are LaTeX-only. Run removal and paragraph structure edits must be sent alone. These forms are mutually exclusive. Equation values are LaTeX (for example, \frac{n}{m}); unsupported LaTeX is rejected. targetHandle remains valid after successful value-only or run-style edits. A successful run split, run removal, cell paragraph clone/remove/add, or row clone/remove invalidates every prior targetHandle and structuralCoord version and returns structureChanged plus a new structureVersion; the anchor remains usable without relisting. addParagraph also returns newParagraphIndex. Do not mix row structure edits with value edits. Use updatedTargets only for non-structural edits. Do not put multiple adjacent cells in the same table into one batch; apply them in separate batches. A batch contains at most the configured edit limit.
apply_edits