Delete sheet Version 7 (Net)
Action group: Excel
Description
Deletes a sheet from the document.
Icon
Settings of parameters
Property | Description | Type | Example of filling in | Obligatory to fill in the field |
---|---|---|---|---|
Parameters | ||||
Context | The unique identifier of the session to which the action will be applied. | Excel instance | EXCEL_INSTANCE | Yes |
Sheet identification method | Specifies a way to identify a sheet through a name or index. Drop-down list:
After selecting the value of this field, the action will refer to either the value of the "Sheet name" field or the value of the "Sheet index" field. | String | Sheet index | Yes |
Sheet name | The name of the sheet to which the action will be applied. | String | Sheet1 | No |
Sheet index | The sequence number of the sheet to which the action will be applied. | Numeric | 1 | No |
Special conditions of use
The only existing sheet cannot be deleted, an error will be caused.
The active sheet does not change if it is not the one selected for deletion.
If an active sheet has been deleted, the next sheet in order, if it exists, becomes active.
If the next sheet does not exist, the previous sheet is activated.
Example of use
Task
An Excel document has 2 sheets named "Sheet1" and "Sheet2". You need to delete "Sheet2".
Solution
Use the actions "Open", "Delete sheet", "Save".
Implementation
- Assemble a robot scheme consisting of actions:
- Customize the parameters of the "Open" action. In the "Path to file " field, specify the path to the required Excel file. Checkbox Open Visible = true to display the robot actions on the screen.
- Customize the parameters of the "Delete sheet" action. In the "Context" field specify the context of the opened document, in the "Sheet identification method" field select "Via sheet name", in the "Sheet name" field specify the value "Sheet2". Leave the "Sheet index" field empty because the search will be performed by sheet name.
Customize the parameters of the "Save" action. Specify the context of the Excel document in the Context parameter.
Launch the robot using the "Start" button in the top panel.
Result
The robot completed successfully. Sheet2 is deleted from the document.