История страницы
...
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
Property | Description | Type | Filling example | Mandatory field |
Parameters | ||||
Table | The table in which you want to change the column names |
Свойство
Описание
Тип
Пример заполнения
Обязательность заполнения поля
Параметры
Таблица
. | Robin.DataTable |
Yes |
Названия столбцов
Columns names | List of new names that will replace the current column names. | Robin.Collection |
Да
Особые условия использования
- На вход принимает коллекцию, содержащую список новых названий для столбцов входной таблицы.
- Переименование столбцов происходит по порядку: 1й элемент коллекции - 1й столбец, 2й элемент - 2й столбец, и т.д.
- Если в коллекции элементов меньше, чем кол-во столбцов таблицы, действие не возвращает ошибку, а переименовывает все столбцы, на которых хватило элементов.
- Если в коллекции элементов больше, чем кол-во столбцов таблицы, действие не возвращает ошибку, лишние элементы просто не используются.
- Если в коллекции содержатся одинаковые названия, действие вернет ошибку.
Пример использования
Пример использования
Задача: существует документ Excel с таблицей, необходимо изменить названия столбцов у таблицы на "название страны", "название столицы". Таблицу с низменными столбцами необходимо вставить ниже , начиная с ячейки А9.
Решение: воспользоваться действиями "Открыть", "Взять таблицу", "Изменить названия столбцов", "Вставить таблицу", "Сохранить".
Реализация:
...
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
- Assemble a robot scheme consisting of the actions: "Open", '"Get table", "Change column names", "Insert table", "Save".
- 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.
- 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.
In the "Columns names" field, specify a variable of type "String" with the required column names.
6. Customize parameters for the "Save" action. Specify the context of the Excel document in the Context parameter.- 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
...
Результат:
Робот отработал успешно.
В таблице Excel изменены названия столбцов.