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

ContextThe unique identifier of the session to which the action will be applied.Excel instanceEXCEL_INSTANCEYes
Sheet identification method

Specifies a way to identify a sheet through a name or index.


Drop-down list:

  • Via sheet name
  • Via sheet index

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.

StringSheet1No
Sheet index

The sequence number of the sheet to which the action will be applied.
The sequence number starts with "1".

Numeric1No

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

  1. Assemble a robot scheme consisting of actions: 
  2. 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. 

  3. 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.
  4. Customize the parameters of the "Save" action. Specify the context of the Excel document in the Context parameter. 

  5. Launch the robot using the "Start" button in the top panel. 

Result

The robot completed successfully. Sheet2 is deleted from the document. 

  • Нет меток