Import data into branch
layerz_import_branchWrites values onto a branch of the model, creating the branch when branch.id names none (branch.display_name required then; branch.actuals_through sets its cutover). Two sources, mutually exclusive: entries[] (one value per item and period; items resolved by item_uid or item_label, created as assumptions when absent; entry_uid / entry_label target one entry of a list-mode item) or file_id (an uploaded spreadsheet parsed server-side, each row classified with the model's mapping rules; sheet_name, structure_override, replace_source_id refine the parse). An entry's timeline_ref equals the target item's grain or constant (any other grain is rejected); on a formula / balance it is a per-period override; on a callup it lands on the source (redirected). A data source is materialized on the file_id path and when record_import is given; bare entries[] write a manual overlay with no source. replace: true (with branch.id) wipes the branch's rows before writing, uncovered periods keeping their prior value; merge: true upserts cell by cell; dry_run: true returns the impact (would_persist: false, overridden_items, validation_errors_new) without persisting. Returns dataset_id, created_items, matched_items, entries_written, inputs_written, inputs_removed, warnings (plus skipped, mapping_drift, file_structure on the file path). Persists one version labelled with summary. Not advertised to read-only keys.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| merge | No | ||
| branch | Yes | ||
| dry_run | No | ||
| entries | No | ||
| file_id | No | Upload id from layerz_create_upload_url ('f_' + 16 hex chars). Alternative to entries[]. | |
| replace | No | ||
| summary | Yes | Short note (3–100 chars) describing the change, stored as the label of the resulting version. Examples: "Renamed Revenue to Net Revenue", "Imported 2024 OPEX from Excel". | |
| model_id | No | Target model UUID. Required for user-scoped API keys; validated against the bound model for model-scoped keys. | |
| sheet_name | No | ||
| record_import | No | ||
| replace_scope | No | ||
| replace_source_id | No | file_id path only: refresh this existing file source in place (id from layerz_list_integrations) instead of creating a second one. | |
| structure_override | No | Override auto-detected columns for a long-format/ledger file (e.g. value_column chose "Débit" and dropped credit rows, or an account-code column won the label). Omitted fields stay auto-detected. |