Delete sheet Version 1 (Python)

Action group: Office


Description

The action deletes a sheet from the document. The only existing sheet cannot be deleted, an error will be thrown. The active sheet is not changed if it is not the one selected for deletion. If the active sheet is deleted, the next sheet in the order, if it exists, becomes active. If the next sheet does not exist, the previous sheet is activated

Action icon

Settings of parameters

PropertyDescriptionTypeFilling exampleMandatory field
Parameters
ContextAction context for ods/xlsx documentRobin.OpenSheetD oc
Yes
Sheet identification methodThe parameter sets the identification method of the sheet to delete: via name or indexRobin.String
Yes
Sheet nameThe name of the sheet to be deletedRobin.String
No
Sheet indexThe sequence number of the sheet to be deleted. The sequence number starts with «1»Robin.Numeric
No

Special conditions of use

None.

Example of use

Task

There is a document called Test with two sheets - Sheet 1 and Sheet 2. You need to delete Sheet 2 from the document. 

Solution

Use the actions "Open", "Delete sheet", "Save". 

Implementation

  1. Assemble a robot scheme consisting of actions: 



  2. Set the "Path to file" parameter for the "Open" action.  

      

  3. Set parameters for the "Delete sheet" action. In the "Context" field specify the open document context, in the "Sheet identification method" field specify "by sheet name". In the "Sheet name" field specify "Sheet 2". 


  4. Set the parameter for 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 program robot completed successfully.

The sheet named "Sheet 2" has been successfully deleted from the document. 

 

  • Нет меток