Get sheet names Version 1 (Python)

Action group: Office


Description

The action returns a collection with the sheet names of the tabular document.

Action icon

Settings of parameters

PropertyDescriptionTypeFilling exampleMandatory field
Parameters
ContextAction context for working with ods/xlsx table.Robin.OpenSheetD oc
Yes
Results
ResultA collection with the sheet names of the tabular document.Robin.Collection

Special conditions of use

None.

Example of use 

Task

The tabular document "Test 1" has 3 sheets named "Sheet 1", "Sheet 2" and "Sheet 3". It is necessary to get the names of these sheets and write them in the document in a line.

Solution

Use the actions "Open", "Get sheet names", "Set row values", "Save".

Implementation

Assemble a robot scheme consisting of actions:

Set parameters for the "Open" action. In the "Path to file" field specify the path to the required tabular document.

Set parameters for the "Get sheet names" action. In the "Context" field specify the context of the opened document, in the "Result" field specify a variable with the "Collection" type to which the data will be written.

Set parameters for the "Set row values" action. In the "Context" field specify the context of the opened document. In the "Row number" field specify the value "1", in the "Initial column number" field specify the value "1", in the "List of values" field specify the variable with the type "Collection" obtained as a result of the previous action (p. 2).

Set parameters for the "Save" action. In the "Context" parameter specify the context of the tabular document.

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

Result

The program robot completed successfully.

In the "Test 1" document, the sheet names have been added to line 1.


  • Нет меток