Use Delete Worksheet to permanently remove one existing worksheet from an .xlsx workbook in OneDrive for Business or a SharePoint document library. The step protects the workbook's final visible worksheet from deletion.
Step Library: Microsoft Excel > Worksheet management
When to use this step
Use this step when you want to:
- permanently remove a specific worksheet from an existing workbook;
- address the workbook through a selected Microsoft 365 file, a Microsoft Excel Workbook Object, or drive and item IDs; or
- identify the worksheet through the provider picker, a fixed worksheet ID or exact name, or a Text variable.
Common examples include:
- removing a temporary import worksheet after its data has been processed;
- deleting an obsolete reporting period from a workbook; or
- cleaning up a worksheet created earlier in a workflow.
Use Clear Range Contents instead when you want to keep the worksheet and remove only cell values. Use Delete Table when you want to remove a table rather than its complete worksheet.
Before you begin
- Create or select a Microsoft Excel connection that uses a Microsoft work or school account. The connection requires delegated
Files.ReadWritepermission. - Ensure the connected account can edit the target
.xlsxworkbook. - Keep at least one other worksheet visible when the target worksheet is visible.
- Confirm that the target worksheet and its contents can be permanently deleted. Flowifier does not restore a deleted worksheet.
- If you use a Microsoft Excel Workbook Object, make it available as a workflow variable or as the Workbook output of an earlier step.
Configure the step
- Add Delete Worksheet from Microsoft Excel > Worksheet management.
- Select the step to open its configuration panel.
- Select the Microsoft Excel Connection.
- In Workbook source, select Microsoft 365 file, Workbook variable, or Drive and item IDs, then configure the displayed workbook settings.
- Select the Worksheet, enter its ID or exact name, or select a Text variable.
- Confirm that another worksheet remains visible when the target is visible.
- Save or publish the workflow.
Settings
| Setting | Required | Accepted values | Visible when | Description |
|---|---|---|---|---|
| Connection | Yes | Microsoft Excel connection | Always | Connection used to access Microsoft Graph. There is no default. The connection must be available to the workflow, remain authorized, and have write access to the workbook. |
| Workbook source | Yes |
Microsoft 365 file, Workbook variable, or Drive and item IDs
|
Always | Selects how the workbook is identified. The default is Microsoft 365 file. |
| Workbook file | Yes | Selected .xlsx file or an Object variable with schema @microsoft/drive-item-reference@v1
|
Workbook source = Microsoft 365 file |
Supplies the workbook's drive and item identity. There is no default file. At runtime, the selected value or variable must resolve to an accessible .xlsx file. |
| Workbook variable | Yes | Object variable or step output with schema microsoft-excel/workbook@1
|
Workbook source = Workbook variable |
Supplies a workbook reference published by a previous Microsoft Excel step or stored in a compatible Object variable. There is no default. The resolved Object must contain non-empty Drive ID and Item ID values. |
| Drive ID | Yes | Fixed Text or Text variable | Workbook source = Drive and item IDs |
Identifies the OneDrive for Business or SharePoint drive. There is no default. The resolved value must not be empty. |
| Item ID | Yes | Fixed Text or Text variable | Workbook source = Drive and item IDs |
Identifies the .xlsx workbook within the selected drive. There is no default. The resolved value must not be empty. |
| Worksheet | Yes | Provider-selected worksheet, fixed worksheet ID or exact name, or Text variable | Always | Identifies the worksheet to delete. There is no default. The provider picker is available when the connection and workbook have fixed identities. Fixed and variable values must not be empty. At runtime, the value must match a current worksheet ID or exact name, and deleting the final visible worksheet is not allowed. |
Data and outputs
Workflow variable effects
This step does not modify workflow variables.
Step outputs
| Step output | Type | Available when | Scope | Description |
|---|---|---|---|---|
| Workbook | Object — Microsoft Excel Workbook (microsoft-excel/workbook@1) |
After successful completion | Following steps in the current workflow context until the execution path ends | Reusable reference to the resolved workbook after the worksheet is deleted. It always contains Drive ID and Item ID; Name and Web URL are included when the selected input provides them. It is not exposed when the step fails. |
Runtime behavior
Execution and completion
When the step runs, Flowifier:
- Resolves the selected connection, workbook reference, and Worksheet value.
- Opens a persistent Microsoft Excel workbook session.
- Lists the workbook's current worksheets and resolves the configured worksheet by ID or exact name.
- Fails before sending a deletion request if the worksheet no longer exists.
- Fails before sending a deletion request if the target is the workbook's final visible worksheet.
- Sends one worksheet deletion request to Microsoft Graph.
- Exposes Workbook and completes the step after Microsoft Graph confirms the deletion. The workbook session is then closed on a best-effort basis.
Worksheet deletion is a permanent, externally visible side effect. The deleted worksheet is not restored if a later workflow step fails. Running the same configuration again after a successful deletion fails because the target no longer exists; Flowifier does not delete another worksheet instead. A hidden or very hidden worksheet can be deleted while another worksheet remains visible.
Branches and child steps
This step does not have branches or child steps.
Failure, retry and resume behavior
This step does not suspend execution and has no resume point. The worksheet-deletion request is not automatically retried. Safe session setup and worksheet-listing requests may retry transient throttling or service errors before the deletion request is sent.
If validation, authentication, permission, workbook, worksheet, or provider validation fails before deletion, the step fails and the workflow does not continue along its normal execution path. The workbook remains unchanged and no Workbook output is exposed.
Because deletion is a mutation, a network interruption, timeout, or service failure after Microsoft Graph receives the request can leave the outcome unknown. The worksheet might already be deleted even though the step failed. Inspect the workbook before starting another execution. Cancellation or termination does not restore a worksheet that Microsoft Graph has already deleted.
Errors and limits
| Situation | Result | Resolution |
|---|---|---|
| A required fixed setting is missing | Designer validation reports the affected setting and prevents a valid publish. | Complete Connection, the settings shown for the selected Workbook source, and Worksheet. |
| A variable is missing, has the wrong type or Object schema, or resolves to an empty value | The step fails before deleting the worksheet and reports the invalid workbook or worksheet input. | Ensure each variable exists, has the compatible type or schema, and resolves to a non-empty supported value. |
The configured workbook does not exist, is inaccessible, or is not a supported .xlsx workbook |
The step fails without deleting a worksheet. | Select an accessible .xlsx workbook, or correct Drive ID and Item ID. |
| The configured worksheet ID or name does not exist | The step fails with The Excel worksheet reference is invalid or unavailable. Select an existing worksheet and try again. No worksheet is deleted. |
Select a current worksheet, correct the fixed ID or exact name, or update the Text variable. |
| The target is the workbook's final visible worksheet | The step fails with The last visible worksheet cannot be deleted. Make another worksheet visible before deleting it. The worksheet remains unchanged. |
Create another worksheet or make another worksheet visible, then start a new execution. |
| The same configuration runs again after successfully deleting the worksheet | The repeated execution fails with the missing-worksheet message. No different worksheet is deleted. | Reconfigure Worksheet only when another intentional deletion is required. |
| The connection is unavailable, expired, or lacks permission | The step fails without exposing connection credentials or provider details. | Reconnect Microsoft Excel, grant the required permission, confirm workflow access to the connection, and verify write access to the workbook. |
| Microsoft Graph throttles, times out, becomes unavailable, or cannot confirm the deletion result | The step fails without automatically retrying the deletion request. If the request reached Microsoft Graph, the worksheet might already be deleted and the outcome is unknown. | Inspect the workbook first. If the worksheet still exists, wait if necessary and start a new execution. |
The step has no additional numeric limits beyond Microsoft Excel's workbook and worksheet constraints and the general workflow limits.
Example
Remove a completed import worksheet
Goal: Delete a temporary import worksheet after its data has been processed while keeping the workbook usable.
Configuration:
-
Connection:
Operations Microsoft Excel -
Workbook source:
Microsoft 365 file -
Workbook file:
Operations / Imports / Current import.xlsx -
Worksheet:
Raw import
Result: Flowifier confirms that Raw import exists and is not the final visible worksheet, then permanently deletes it. A following step can continue working with the workbook and reuse the Workbook output. Repeating the same configuration fails without deleting another worksheet.
Related information
- Create Worksheet — add a worksheet to an existing workbook.
- List Worksheets — retrieve worksheet details before choosing another operation.
- Rename Worksheet — change a worksheet name without deleting its contents.
- Clear Range Contents — remove cell contents while preserving the worksheet.
- Microsoft Excel connections — connect a Microsoft work or school account and authorize workbook access.
- Workflow variables — supply dynamic workbook identities and worksheet references.
- Microsoft Graph: Delete worksheet — provider API behavior for deleting a worksheet.
Comments
0 comments
Please sign in to leave a comment.