Skip to main content

Module format

Module format 

Source
Expand description

Cell/border formatting, merging and auto-resize via spreadsheets.batchUpdate (issue #1643, ADR-0077).

Six verbs, all gated by DriveOperation::SheetsStructure — none destroy data, with one deliberate exception called out below.

Shape follows structure.rs exactly: target_gate::resolve for the target and gate, then a spreadsheets.get (needed to resolve the target sheet’s numeric id and, for merge-cells, its current values), then a --dry-run early return, then the mutation, then one drivemutation record. Unlike structure.rs’s verbs (each addressing a whole sheet), these address a range, composed from --sheet/ --range exactly as write.rs’s cell verbs do (a1::compose), then converted to a numeric GridRange via grid_range::parse_grid_range.

format-cells cannot write a value. It builds a repeatCell request whose cell is RepeatCellData — a type with no userEnteredValue field at all — so there is nowhere to put one regardless of what a caller asks for. This is format-cells’ structural answer to “does updateCells belong here or in the cell-write surface”: it uses repeatCell exclusively and never updateCells, so the sheets-structure grant can never be used to write a value the way sheets-write can.

merge-cells is the one request here that discards data. Merging a range keeps only the top-left cell’s value; every other non-blank cell in the range is silently dropped. Both the dry run and the real run read the range’s current values first (one values.get, after the gate like every other read in this module) and the outcome — and its --dry-run preview — name every non-top-left, non-blank cell that would be lost, exactly the honesty ADR-0075 §6 requires of a preview whose effect a bounded range can’t otherwise express.

Structs§

BorderSides
Which sides an update-borders verb sets. At least one must be true.
CellFormatFlags
The CellFormat flags format-cells exposes.
FormatOptions
Per-call options.
FormatOutcome
The full outcome of one attempt.

Enums§

FormatResult
What happened (or, under --dry-run, would happen).
FormatVerb
Which mutation to perform.
TextRotationFlag
The --text-rotation-angle/--text-rotation-vertical choice.

Functions§

describe
Renders an outcome as human-readable text.
describe_lines
Renders an outcome as its individual lines, none of which contains a newline — see structure.rs::describe_lines for why this shape exists.
format
Runs one formatting mutation, logging every attempt that isn’t a dry run. Never returns Err, matching structure.rs::structure.