Сравнение версий

Ключ

  • Эта строка добавлена.
  • Эта строка удалена.
  • Изменено форматирование.

...

Get table Version 14 (Net)

Группа действийAction group: Excel 

Описание

Действие возвращает значения ячеек из заданной области страницы в виде таблицы.

Иконка

Image Removed

Параметры

Входные параметры  

Контекст                                                          Контекст действия для работы с Excel-документом

Имя столбца начальной ячейки                   Имя столбца начальной ячейки (начало диапазона), от которой будет установлена область.

Индекс столбца начальной ячейки              Индекс столбца начальной ячейки (начало диапазона), от которой будет установлена область.

Строка начальной ячейки                             Строка начальной ячейки (начало диапазона), от которой будет установлена область.

Имя столбца конечной ячейки                     Имя столбца конечной ячейки (конец диапазона), до которой будет установлена копируемая область.

Индекс столбца конечной ячейки                Индекс столбца конечной ячейки (конец диапазона), до которой будет установлена копируемая область.

Строка конечной ячейки                               Строка конечной ячейки (конец диапазона), до которой будет установлена копируемая область.

Пропустить скрытые                                      Логическая переменная.

С заголовком                                                  Если значение «true», первая строка таблицы будет выделена отдельно как заголовок и не будет входить в строки с содержимым таблицы.

Убрать дубли заголовка                                 Если значение «true», в заголовке полученной таблицы к одинаковым названиям столбцов будут добавлены индексы.

Выходные параметры

Результат Переменная, в которую будут записаны данные диапазона

Настройки

...

Свойство

...

Описание

...

Тип

...

Пример заполнения

...

Обязательность заполнения поля

...

Параметры

...

Контекст

...

Контекст действия для работы с Excel-документом

...

Robin.Excel

...

Контекст excel

...

Да

...

Имя столбца начальной ячейки

...

Имя столбца начальной ячейки (начало диапазона), от которой будет установлена область. Если поле не заполнено, то берется значение из поля «Индекс столбца начальной ячейки».

...

Robin.String

...

Нет

...

Индекс столбца начальной ячейки

...

Индекс столбца начальной ячейки (начало диапазона), от которой будет установлена область. Если поле не заполнено, то берется граница используемой области.

...

Robin.Numeric

...

Нет

...

Строка начальной ячейки

...

Строка начальной ячейки (начало диапазона), от которой будет установлена область. Если поле не заполнено, то берется граница используемой области.

...

Robin.Numeric

...

Нет

...

Имя столбца конечной ячейки

...

Имя столбца конечной ячейки (конец диапазона), до которой будет установлена копируемая область. Если поле не заполнено, то берется значение из поля «Индекс столбца конечной ячейки».

...

Robin.String

...

Нет

...

Индекс столбца конечной ячейки

...

Индекс столбца конечной ячейки (конец диапазона), до которой будет установлена копируемая область. Если поле не заполнено, то берется граница используемой области.

...

Robin.Numeric

...

Нет

...

Description

Action returns cell values from the specified page area in the form of a table.

Icon

Image Added

Settings of parameters

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:

From excel we get the table:

Image Added

With this option enabled, the log will show "Columns: 3; Rows: 2" because the first row of the taken area has become a header with the column names "No.", "Title" and "Tests". These headings cannot be accessed as a row of data to read, but you can use the column names to access a specific cell or column (actions from the "Tables" group). If the option is off, the log will show "Columns: 3; rows: 3", the column names in the header will be "1", "2" and "3".

For the "Remove duplicate header" checkbox

When true, the header of the tabular value that actions return as a result will have indices added to the same column names. The numbering starts from 1.  
Example #1:
There is a table in Excel:
Image Added
With "Remove duplicate header" = true, and "Heading" = True, the "Get table" action will return a table of 10 rows and 4 columns. The column names of this table will be "No.", "Title", "Tests1", "Tests2".
Example #2:
There is a table in excel:
Image Added
When "Remove duplicate header" = true, and "Heading" = True, the "Get table" action will return a table of 4 rows and 5 columns. The column names of this table will be:

"Test31", "Test21", "Test22", "Test32", "Test1".

If false, the column names will remain the same. Actions on net that return/process such tables with duplicated column names will crash with an error, because net cannot have a header with the same column names.

For example, the source table has columns "Test1", "Test" and "Test". If we add indexes only to the current takes, the names will become "Test1", "Test1" and "Test2", i.e. eventually there will be new takes with the name "Test1". Therefore, when renaming a particular column, the action should check if another column already has such a name and if there is such a match, the current column should have the next index. That is, in this case the action will rename the columns as "Test1", "Test2" and "Test3".

Example of use

Task

There are 2 Excel documents "Test" and "Test1". It is necessary to take a table from the "Test" document and paste it into the "Test1" document starting from cell A3.

Image Added

Solution

Use the actions "Open", "Get table", "Insert table", "Save".  

Implementation

  1. Assemble a robot scheme consisting of the actions: "Open", "Get table", "Insert table", "Save". 
    Image Added

  2. Configure parameters for the "Open" action. In the "File path" field, specify the path to the required Excel file. Check the Visible = true checkbox to display robot actions on the screen. 
    Image Added

  3. Set up parameters for the "Get table" action. In the "Context" field specify the context of the opened document, create a variable of the "Table" type to which the data will be written and specify it in the "Result" field.  Leave the other fields empty, because it is necessary to take the table completely. 
    Image Added

  4. Configure parameters for the "Open" action. In the "File path" field, specify the path to the required Excel file where the table should be inserted. Check the Visible = true checkbox to display robot actions on the screen. 
    Image Added

  5. Customize parameters for the "Insert table" action. In the "Context" field specify the context of the opened document, in the "Start cell column name" field specify the value "A", in the "Start cell row" field specify the value "3". In the "Table" field specify the previously created variable "Table" with data. 
    Image Added

  6. Customize parameters for the "Save" action. In the "Context" parameter specify the context of the Excel document where the table with data will be inserted. 
    Image Added

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

Result

The program robot completed successfully. 

Image Added

A table starting in cell A3 has been inserted into the document "Test1". 

Image Added

...

Строка конечной ячейки

...

Строка конечной ячейки (конец диапазона), до которой будет установлена копируемая область. Если поле не заполнено, то берется граница используемой области.

...

Robin.Numeric

...

Нет

...

Пропустить скрытые

...

Логическая переменная. Если значение параметра равно True, то возвращаются только видимые строки и столбцы, иначе - все.

...

Robin.Boolean

...

true

...

Нет

...

С заголовком

...

Если значение «true», первая строка таблицы будет выделена отдельно как заголовок и не будет входить в строки с содержимым таблицы.

...

Robin.Boolean

...

true

...

Нет

...

Убрать дубли заголовка

...

Если значение «true», в заголовке полученной таблицы к одинаковым названиям столбцов будут добавлены индексы. Нумерация начинается с 1.

...

Robin.Boolean

...

true

...

Нет

...

Результат

...

Переменная, в которую будут записаны данные диапазона

...

Robin.DataTable

Особые условия использования

Для чек-бокса "С заголовком" 

Работа параметра: При значении "true" действие первую строку исходной таблицы сохранит в заголовок возвращаемого табличного значения, т.е. она не будет являться строкой с содержимым таблицы.
 При "false" первую строку оставит в части с содержимым таблицы, а в заголовке будут использоваться названия по умолчанию - 1, 2, 3 и т.д.

Пример:

Из excel забираем таблицу:
Image Removed

При включенном параметре в логе будет указано "Столбцов: 3; строк: 2", т.к. Первая строка взятой области стала заголовком с названиями столбцов "№", "Название" и "Тесты". К этим заголовкам нельзя обратиться как к строке данных, чтобы прочитать, но можно использовать имена столбцов, чтобы обратиться к конкретной ячейке или столбцу (действиями из группы "Таблицы"). Если параметр выключен, то в логе будет указано "Столбцов: 3; строк: 3", названия столбцов в заголовке будут "1", "2" и "3".

Для чек-бокса "Убрать дубли заголовка"

При значении "true", в заголовке табличного значения, которое действия возвращают как результат, к одинаковым названиям столбцов будут добавлены индексы. Нумерация начинается с 1. 
Пример №1:
В excel есть таблица:
Image Removed
При "Убрать дубли заголовка" = true, и "С заголовком" = True, действие "Взять таблицу" вернет таблицу из 10 строк и 4х столбцов. Названия столбцов этой таблицы будут "№", "Название робота", "Тесты1", "Тесты2".
Пример №2:
В excel есть таблица:
Image Removed
При "Убрать дубли заголовка" = true, и "С заголовком" = True, действие "Взять таблицу" вернет таблицу из 4х строк и 5 столбцов. Названия столбцов этой таблицы будут:

"Тест31", "Тест21", "Тест22", "Тест32", "Тест1".

При значении "false", названия столбцов останутся прежними. Действия на net, которые возвращают\обрабатывают такие таблицы с задублированными названиями столбцов, будут падать с ошибкой, т.к. в net не может быть заголовка с одинаковыми названиями столбцов.

Например, в исходной таблице есть столбцы "Тест1", "Тест" и "Тест". Если добавлять индексы только к текущим дублям, то названия станут такими "Тест1", "Тест1" и "Тест2", т.е. в итоге появятся новые дубли с названием "Тест1". Поэтому действие при переименовании конкретного столбца должно проверять, нет ли уже такого названия у другого столбца и при наличии таких совпадений проставлять у текущего столбца следующий по счету индекс. Т.е. в данном случае действие переименует столбцы как "Тест1", "Тест2" и "Тест3".

Пример использования

Задача

Существует 2 Excel - документа "Test" и "Test 1". Необходимо взять таблицу из документа "Test" и вставить ее в документ "Test 1" начиная с ячейки А3.

Image Removed

Решение

Воспользоваться действиями "Открыть", "Взять таблицу", "Вставить таблицу", "Сохранить". 

Реализация

...

Результат

Робот отработал успешно. 

Image Removed

В документ "Test 1" вставлена таблица начиная с ячейки А3. 

Image Removed