Delete sheet
delete_sheetDeletes a sheet from a session workbook by 0-based index and recalculates affected formulas, turning references to the removed sheet into #REF!.
Instructions
Delete a sheet from a session's workbook, found by its 0-based index (see the sheets list from create_session or inspect_model), the way Excel does: formulas on other sheets that referenced it now read #REF! (Gone!A1 becomes #REF!A1) and evaluate to #REF!, a 3D range ending on it (Jan:Mar!B2) shrinks to the neighbouring sheet, names scoped to it are removed and names that pointed into it refer to #REF!. Sheets after it move down one index, so re-read indexes from the result before the next call. Works on imported and blank workbooks, and recalculates. It can't be undone: restore_session brings back other cells but not the sheet, so export_workbook or save_to_library first if you may need it. Returns {deleted: {sheet_index, sheet_name}, sheets: [{index, name}], active_sheet, formulas_broken (up to 200 cell refs), formulas_broken_count, names_removed, names_broken}. The last sheet, the last visible sheet or an index past the last sheet fails with bad_request and changes nothing. To retitle a sheet use rename_sheet; to empty one without breaking references, overwrite its cells with set_inputs.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| session_id | Yes | Session ID returned by create_session (list_sessions shows the open ones) | |
| sheet_index | Yes | 0-based index of the sheet to delete |