Get sheets names Version 6 (Net)

Action group: Excel 


Description

Gets a list of the document sheets and their number. 

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
Results
NamesA variable that will hold the names of all the sheets in the document.CollectionList of sheets

Special conditions of use

None.

Example of use  

Task

An Excel document has 2 sheets with the names "Sheet 1" and "Sheet 2". It is necessary to get the names of these sheets and record them in cells A1 and B1.

Solution: use the actions "Open", "Get sheets names", "Set row data", "Save". 

Implementation 

  1. Assemble a robot scheme consisting of the actions:
  2. Configure parameters for the "Open" action. In the "PathToFile" field, specify the path to the required Excel file. Check the "Open" Visible = true checkbox to display the robot actions on the screen.  

  3. Set up parameters for the "Get sheets names" action. In the "Context" field specify the context of the opened document, in the "Names" field specify a variable with the "Collection" type to which the data will be written. 
  4. Set parameters for the "Set row data" action. In the "Context" field specify the context of the opened document. In the "Row" field specify the value "1". In the "Starting column name" field specify the value "A". In the "A list of values" field specify a variable with the "Collection" type obtained as a result of the previous action (step 3). 
  5. Configure parameters for the "Save" action. Specify the context of the Excel document in the Context parameter. 

        5. Start the robot by clicking the "Start" button in the upper panel. 

Result

The software robot completed successfully. 

Sheet names have been added to cells A1 and B1. 

  • Нет меток