Change column names Version 1 (Net)

Action group: Tables


Description

The action is intended for changing the names of table columns

Action icon


Settings of parameters

PropertyDescriptionTypeFilling exampleMandatory field
Parameters
TableThe table in which you want to change the column names.Robin.DataTable
Yes
Columns namesList of new names that will replace the current column names.Robin.Collection
Yes

Special conditions of use

  • It takes as input a collection containing a list of new names for the columns of the input table.
  • The columns are renamed in order: 1st element of the collection - 1st column, 2nd element - 2nd column, etc.
  • If there are fewer items in the collection than the number of columns in the table, the action does not return an error, but renames all columns that have enough items.
  • If the collection contains more items than the number of columns in the table, the action does not return an error, the extra items are simply not used.
  • If the collection contains identical names, the action returns an error.

Example of use

Task 

There is an Excel document with a table, it is necessary to change the column names of the table to "country name", "capital city name". The table with lowered columns should be inserted below, starting from cell A9.

Solution

Use the actions "Open", "Get table", "Change column names", "Insert table", "Save".

Implementation

  1. Assemble a robot scheme consisting of the actions: "Open", '"Get table", "Change column names", "Insert table", "Save".
  2. Configure parameters for the "Open" action. In the "Path to file" field, specify the path to the required Excel file. Check the Visible = true checkbox to display robot actions on the screen. 
  3. Set the parameters for the "Get table" action. Specify the context of the opened document in the "Context" field, create a variable of the "Table" type to which the data will be written and specify it in the "Result" field. Check the checkbox "Heading" = true.  Leave the rest of the fields empty, because it is necessary to take the table completely.  

  4. Set up the parameters for the "Change column names" action. In the "Table" field specify a variable of the "Table" type obtained at the previous step. 


    In the "Columns names" field, specify a variable of type "String" with the required column names. 


    5. Set the parameters of the "Insert table" action.




    6. Customize parameters for the "Save" action. Specify the context of the Excel document in the Context parameter.



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

Result

The program robot completed successfully. 

The names of the columns in the Excel spreadsheet have been changed. 


  • Нет меток