Get table Version 14 (Net)
Action group: Excel
Description
Action returns cell values from the specified page area in the form of a table.
Icon
Parameters
Input parameters
Name | Description |
---|---|
Context | The action context for working with an Excel document |
Start cell column name | The column name of the start cell (beginning of the range) from which the area will be set. |
Start cell column index | The column index of the starting cell (range start) from which the area will be set. |
Start cell row | The row of the starting cell (start of the range) from which the area will be set. |
End cell column name | The column name of the end cell (end of range) to which the area to be copied will be set. |
End cell column index | The column index of the end cell (end of range) to which the area to be copied will be set. |
End cell row | The end cell row (end of range) to which the area to be copied will be set. |
Skip hidden | Boolean variable. |
Heading | If true, the first row of the table will be highlighted separately as a header and will not be included in the table content rows. |
Remove duplicate header | If true, indexes will be added to the same column names in the header of the resulting table. |
Output parameters
Result Variable to which the range data will be written
Settings
Property | Description | Type | Example of filling in | Obligatory to fill in the field |
Parameters | ||||
Context | Action context for working with an Excel document | Excel instance | Context excel | Yes |
Start cell column name | The column name of the initial cell (the beginning of the range) from which the area will be set. If the field is not filled in, the value from the "Index cell column name" field is taken. | String | No | |
Index cell column name | Column index of the initial cell (beginning of the range) from which the area will be set. If the field is not filled in, the boundary of the used area is taken. | Numeric | No | |
Start cell row | The row of the initial cell (beginning of the range) from which the area will be set. If the field is not filled in, the boundary of the used area is taken. | Numeric | No | |
End cell column name | The column name of the end cell (end of range) to which the area to be copied will be set. If the field is not filled in, the value from the "End cell column index" field is taken. | String | No | |
End cell column index | The column index of the end cell (end of range) to which the area to be copied will be set. If the field is not filled in, the boundary of the used area is taken. | Numeric | No | |
End cell row | The row of the end cell (end of the range) to which the area to be copied will be set. If the field is not filled in, the boundary of the used area is taken. | Numeric | No | |
Skip hidden | A boolean variable. If True, only visible rows and columns are returned, otherwise all rows and columns are returned. | Boolean | true | No |
Heading | If true, the first row of the table will be highlighted separately as a header and will not be included in the table content rows. | Boolean | true | No |
Remove duplicate header | If the value is "true", indexes will be added to the same column names in the header of the resulting table. The numbering starts from 1. | Boolean | true | No |
Results | ||||
Result | The variable into which the range data will be written | Table |
Special conditions of use
For checkbox "Heading"
Parameter operation: If "true", the action will keep the first row of the source table in the header of the returned tabular value, i.e. it will not be the row with the table contents.
When "false", the first row will leave the first row in the table content part, and the default names will be used in the header - 1, 2, 3, etc.
Example:
Из excel забираем таблицу:
При включенном параметре в логе будет указано "Столбцов: 3; строк: 2", т.к. Первая строка взятой области стала заголовком с названиями столбцов "№", "Title" и "Tests". К этим заголовкам нельзя обратиться как к строке данных, чтобы прочитать, но можно использовать имена столбцов, чтобы обратиться к конкретной ячейке или столбцу (действиями из группы "Таблицы"). Если параметр выключен, то в логе будет указано "Столбцов: 3; строк: 3", названия столбцов в заголовке будут "1", "2" и "3".
Для чек-бокса "Remove duplicate header"
При значении "true", в заголовке табличного значения, которое действия возвращают как результат, к одинаковым названиям столбцов будут добавлены индексы. Нумерация начинается с 1.
Пример №1:
В excel есть таблица:
При "Remove duplicate header" = true, и "Heading" = True, действие "Взять таблицу" вернет таблицу из 10 строк и 4х столбцов. Названия столбцов этой таблицы будут "№", "Title", "Tests1", "Tests2".
Пример №2:
В excel есть таблица:
При "Remove duplicate header" = true, и "Heading" = True, действие "Взять таблицу" вернет таблицу из 4х строк и 5 столбцов. Названия столбцов этой таблицы будут:
"Test31", "Test21", "Test22", "Test32", "Test1".
При значении "false", названия столбцов останутся прежними. Действия на net, которые возвращают\обрабатывают такие таблицы с задублированными названиями столбцов, будут падать с ошибкой, т.к. в net не может быть заголовка с одинаковыми названиями столбцов.
Например, в исходной таблице есть столбцы "Test1", "Test" и "Test". Если добавлять индексы только к текущим дублям, то названия станут такими "Test1", "Test1" и "Test2", т.е. в итоге появятся новые дубли с названием "Test1". Поэтому действие при переименовании конкретного столбца должно проверять, нет ли уже такого названия у другого столбца и при наличии таких совпадений проставлять у текущего столбца следующий по счету индекс. Т.е. в данном случае действие переименует столбцы как "Test1", "Test2" и "Test3".
Пример использования
Задача
Существует 2 Excel - документа "Test" и "Test1". Необходимо взять таблицу из документа "Test" и вставить ее в документ "Test1" начиная с ячейки А3.
Решение
Воспользоваться действиями "Открыть", "Взять таблицу", "Вставить таблицу", "Сохранить".
Реализация
- Собрать схему робота, состоящую из действий: "Открыть", "Взять таблицу", "Вставить таблицу", "Сохранить".
- Настроить параметры для действия "Открыть". В поле "Путь к файлу" указать путь до требуемого Excel-файла. Проставить чекбокс Видимый = true для отображения действий робота на экране.
- Настроить параметры для действия "Сохранить". В параметре "Контекст" указать контекст Excel-документа, в который будет вставлена таблица с данными.
- Запустить робота по кнопке "Старт" в верхней панели.
Результат
Робот отработал успешно.
В документ "Test1" вставлена таблица начиная с ячейки А3.