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

Ключ

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

...

Table to CSV Version 21 (Net)

Группа действийAction group: ТаблицыTables

Описание

Данное действие предназначено для сохранения таблицы в формате CSV.

...

Description

The action saves tables in the CSV format

Action icon 

...

Settings

PropertyDescriptionTypeFilling exampleMandatory field
Parameters
Data tableTable for which the action will be performed.Robin.DataTable
Yes
EncodingEncoding of the resulting file. UTF-8 is default.Robin.String
No
Line separatorThe character used to separate the lines. Default is rnRobin.String
No
Column separatorCharacter used to separate the columns in the source file. The default is «;».Robin.String
No
File nameName of the file (without extension) to be created. The extension .csv will be added automatically by the action.Robin.String
Yes
FolderFolder path where the created file will be saved.Robin.FolderPathC:\doc\imgYes
HeadingIf true, the table header will be inserted into the document along with its rows.Robin.BooleantrueNo
Results
ResultPath to the created CSV file.Robin.FilePath

...



Special conditions of use

Для параметра "С  заголовком":

  • При значении "true", действие запишет в документ строку заголовка исходной таблицы в качестве первой строки вместе с остальными основными строками таблицы. Пример: в Студии указано, что в таблице "Столбцов: 3; строк: 2", при вставке в документе окажутся заполнены 3 столбца и 3 строки.
  • При "false", действие запишет в документ только основные строки с содержимым исходной таблицы. Пример: в Студии указано, что в таблице "Столбцов: 3; строк: 2", при вставке в документе окажутся заполнены 3 столбца и 2 строки.

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

Задача: имеется Excel файл с таблицей Image Removed . Необходимо ее сохранить в формате CSV с заголовком на рабочий стол.

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

Реализация:

  1. Собрать схему робота, состоящую из действий: 
    Image Removed
  2. Настроить параметр для действия "Открыть". 
    Image Removed
  3. Настроить параметры для действия "Взять таблицу". 
    Image Removed
  4. Настроить параметры для действия "Сохранить таблицу в CSV":
    Image Removed
    В поле "Таблица" указать переменную типа "Таблица" с данными.
    В поле "Кодировка" проставить значение UTF-8.
    В поле "Разделитель строк" - \r\n
    В поле "Разделить столбцов" - ;
    Имя файла указать - Новый; 
    В поле "Папка" указать путь до нового CSV файла;
    В поле "С заголовком" проставить чек-бокс = true. 
    В поле "Результат" указать переменную типа "путь к файлу", в которой будет записан путь до нового файла. 

Результат:

Программный робот отработал успешно.

Image Removed

Таблица сохранена в CSV. Файл расположен по заданному пути.

Image Removed


For a "With Header" parameter: 

  • When “true”, the action will write the header row of the source table into the document as the first row along with the rest of the main rows of the table. Example: the Studio specifies that the table “Columns: 3; rows: 2”, when pasted into the document, 3 columns and 3 rows will be filled in.
  • If “false”, the action will only write to the document the main rows with the contents of the source table. Example: the Studio specifies that the table “Columns: 3; rows: 2”, when inserted into the document, 3 columns and 2 rows will be filled.


Example of use 

Task:

You have an Excel file with the tableImage Added 

Save it in the CSV format with the heading to the workspace. 

Solution

Use the "Open", "Get table", "Table to CSV" actions. 

Implementation

  1. Assemble a robot scheme with the actions:
    Image Added
  2. Set the "Open" action parameters. 
    Image Added
  3. Set the "Get table" action parameters.  
    Image Added
  4. Set the "Table to CSV" action parameters:
    Image Added
    In the “Table” field, specify a variable of the “Table” type with data.
    In the "Encoding" field specify a UTF-8 value.
    In the “Line Separator” field, enter \r\n.
    In the "Line separate" field enter ;
    In the "File name" enter "New". 
    In the "Folder" field set the path to the new CSV file. 
    In the "Heading" check the box = true. 
    In the "Result" field set the "Path to file" variable type that will have the path to the new file. 

Result

The program robot completed successfully. 

Image Added


The table is saved in CSV. The file is located at the specified path.

Image Added

Optional: if the “Heading” checkbox is not checked in the “Table to CSV” action, the table will be saved without a headingДополнительно: если в действии "Сохранить таблицу в CSV" не проставлен чек-бокс "С заголовком", то таблица будет сохранена без заголовка.