Skip to main content

Delete Sheet

Permanently deletes a worksheet from an Excel workbook. This operation cannot be undone.

Common Properties

  • Name - The custom name of the node.
  • Color - The custom color of the node.
  • Delay Before (sec) - Waits in seconds before executing the node.
  • Delay After (sec) - Waits in seconds after executing node.
  • Continue On Error - Automation will continue regardless of any error. The default value is false.
info

If the ContinueOnError property is set to true, no error is caught when the project is executed even if a Catch node is used.

Input

  • Client Id - The client ID from the Connect node (optional if using direct credentials).
  • Workbook Id - The workbook ID from Get Workbook or Create Workbook node.
  • Worksheet Name - Name of the worksheet to delete.

Options

  • Credentials - OAuth2 credentials (optional, alternative to using Client ID).
  • Confirm Deletion - Must be set to true to confirm the deletion. This prevents accidental deletions. Default is false.

Output

  • Success - True if the worksheet was deleted successfully.
  • Deleted Worksheet - Name of the deleted worksheet.
  • Remaining Worksheets - Array of worksheets remaining in the workbook after deletion.

Examples

Delete Worksheet:

// Input
Client Id: ${client_id}
Workbook Id: ${workbook_id}
Worksheet Name: "OldData"
Confirm Deletion: true

// Output - success
true

// Output - deleted_worksheet
"OldData"

// Output - remaining_worksheets
[
{ "Id": "id1", "Name": "Sheet1", "Position": 0 },
{ "Id": "id2", "Name": "Data", "Position": 1 }
]

Cleanup Workflow:

Get Workbook
→ Get Worksheet (list all sheets)
→ Delete Sheet (remove temporary sheets)

Safety Features

This node includes multiple safety features:

  1. Confirm Deletion Required: You must explicitly set Confirm Deletion to true
  2. Last Sheet Protection: Cannot delete the last worksheet in a workbook
  3. Validation: Verifies the worksheet exists before attempting deletion

Use Cases

  • Remove temporary or archive worksheets
  • Clean up old data sheets
  • Delete calculation or staging sheets after processing
  • Maintain workbook organization by removing unused sheets
  • Automate workbook cleanup

Tips

  • Always set Confirm Deletion to true or the node will fail with an error
  • Cannot delete the last worksheet - a workbook must have at least one sheet
  • Deletion is permanent and cannot be undone
  • Consider backing up important data before deletion
  • The Remaining Worksheets output helps verify what's left after deletion

Common Errors

ErrSafetyCheck - "Please confirm deletion"

  • Solution: Set the "Confirm Deletion" option to true

ErrInvalidOperation - "Cannot delete the last worksheet"

  • Solution: Excel workbooks must have at least one worksheet. Create a new sheet first if needed.

ErrNotFound - "Worksheet not found"

  • Solution: Verify the worksheet name is correct. Use Get Worksheet to see all available sheets.

ErrInvalidArg - "Workbook ID cannot be empty"

  • Solution: Ensure you've called Get Workbook first

ErrInvalidArg - "Worksheet name cannot be empty"

  • Solution: Provide the name of the worksheet to delete