Delete variable
delete_variableRemove a defined name from a session's workbook while preserving its cell data; if formulas still use the name, deletion fails and lists cells to update.
Instructions
Delete a defined name from a session's workbook, e.g. one you made with define_variable and no longer need. Only the name goes; the cell it pointed to keeps its value and formula. Match is by name, ignoring case, in workbook scope or, with scope_sheet, the name scoped to that sheet. A name still used by a formula is not deleted: the call fails with name_in_use and lists those cells, so rewrite them with set_inputs (or repoint the name with define_variable) first. A name that doesn't exist in that scope fails with not_found, and Excel's built-in names (print areas, filters) can't be deleted. restore_session doesn't bring a deleted name back; define_variable recreates it. Returns {deleted, scope_sheet, defined_names}, the last being every name left. To see the names first, use inspect_model.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| name | Yes | Defined name to delete, e.g. "Exit_Cap" (case doesn't matter) | |
| session_id | Yes | Session ID returned by create_session (list_sessions shows the open ones) | |
| scope_sheet | No | 0-based sheet index of a sheet-scoped name; omit for a workbook-scoped name |