apply_mto_update
Preview and apply MTO/SCSA reconciliation updates to an MTO Excel file: correct quantities, insert new items, and zero out removed items when explicitly enabled.
Instructions
Write the MTO/SCSA reconciliation into the MTO file.
Always re-derives the diff from the two paths (never trust a caller-supplied diff blob). Quantity corrections and new items are applied whenever dry_run=False - they're additive/corrective, not destructive. Removals (zeroing a quantity because the item left the project) are ONLY written when include_removals=True as well.
Recommended flow: call with dry_run=True first to preview writes, then call again with dry_run=False, and include_removals=True only once you've reviewed the removed list.
Args: mto_path: path to the MTO .xlsx file to update. scsa_path: path to the SCSA .xlsx export (source of truth). category: optional category filter, same as diff_mto_scsa. include_removals: if True, zero out items no longer in SCSA. dry_run: if True, compute and report but write nothing. output_path: write to a different file instead of overwriting mto_path. Defaults to overwriting mto_path in place.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| dry_run | No | ||
| category | No | ||
| mto_path | Yes | ||
| scsa_path | Yes | ||
| output_path | No | ||
| include_removals | No |