Table to CSV Version 21 (Net)

Action group: Tables


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


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 table 

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:
  2. Set the "Open" action parameters. 
  3. Set the "Get table" action parameters.  
  4. Set the "Table to CSV" action parameters:

    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. 


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

Optional: if the “Heading” checkbox is not checked in the “Table to CSV” action, the table will be saved without a heading.

  • Нет меток