Skip to main content

series_bindings.upsert_series_binding()

Insert or replace one series after fail-closed checks.

Usage

Source

series_bindings.upsert_series_binding(
    workbook,
    bindings_path,
    series,
    *,
    replace=False,
    dynamic_refs=None,
    use_cached_dynamic_refs=True,
    blank_ranges=None
)

Schema load, occupancy, and resolution audit run against a temporary copy. The destination tree is written only after those checks succeed.

Parameters

workbook: Path

Workbook the sidecar describes.

bindings_path: Path

Existing sidecar file/directory, or the path to create.

series: Mapping[str, Any]

One series mapping to insert or replace.

replace: bool = False

Replace an existing series with the same id.

dynamic_refs: DynamicRefConfig | None = None

Constraint-based OFFSET/INDEX/INDIRECT config. Ignored when use_cached_dynamic_refs is True.

use_cached_dynamic_refs: bool = True

Resolve dynamic refs from cached workbook values. Library default is True (same as validate_bindings_workbook). The CLI flag --use-cached-dynamic-refs defaults to False, matching other excel-grapher bindings commands.

blank_ranges: Sequence[str] | None = None
Sheet-qualified rectangles omitted from the graph.

Raises

BindingUpsertError
The series is not a valid insertion. The destination bindings tree is left unchanged, including when the path did not exist.