File System - CSV to dataset

Declaration

<AMFILESYSTEM ACTIVITY="csv_to_dataset" SOURCE="text" RESULTDATASET="text" ROWASHEADER="YES/NO" DELIMITER="text (options)" />

Related Topics    

Description

Reads data from a comma-separated values (CSV) file (although the separator character does not necessarily have to be a comma) and populates a dataset with results.

Practical usage

Used to automate the movement of tabular data between programs that natively operate on incompatible (often proprietary) formats. For example, a user may need to transfer information from a database program that stores data in a proprietary format, to a spreadsheet that uses a completely different format. The database program most likely can export its data as "CSV". Automate Desktop can then read the exported CSV onto a dataset  and eventually import the dataset values onto the spreadsheet program.

NOTE: In a CSV file, a text qualifier is placed around each field to signify that it is the same field. This action or any action that involves reading from a CSV file that includes field names and values use the following characters as text qualifiers which will not be read into a dataset or variable:
  • (") double quotes
  • (/) backslash

Parameters

General

Property Type Required Default Markup Description
Source Text Yes (Empty)
  • SOURCE="c:\sourcefolder\file.csv"
  • SOURCE="filename.csv"
The path and file name of the .csv file to read data from.
NOTE: Files with invalid paths are ignored at runtime.
Create and populate dataset Text No (Empty) RESULTDATASET="DatasetName" The name of a dataset to create and populate with information pertaining to the source .csv file. Individual dataset fields vary based on the contents of the source file.

Advanced

Property Type Required Default Markup Description
Treat first line of data as column headers Yes/No No No ROWASHEADER="YES/NO" If selected, Automate Desktop will treat the first line of CSV data as column headers. If disabled, column headers are ignored.
Delimiter Text (options) No (Empty)
  • DELIMITER="comma"
  • DELIMITER="semicolon"
  • DELIMITER="tab"
  • DELIMITER="space"
  • DELIMITER="custom"
The character used to separate the tabular values in a CSV file. The available options are:
  • Comma (default) - A comma is used as a delimiter.
  • Semicolon - A semicolon is used as a delimiter.
  • Tab - A tab is used as a delimiter.
  • Space - A space character is used as a delimiter.
  • Custom - Specifies a custom character.

Description

Error Causes

On Error

Example

NOTE:
  • Copy and paste the sample AML code below directly into the Task Builder Steps Panel.
  • To successfully run the sample code, update parameters containing user credentials, files, file paths, or other information specific to the task to match your environment.

Description

This sample task saves a CSV file into a dataset.

Copy
<AMFILESYSTEM ACTIVITY="csv_to_dataset" SOURCE="C:\temp\comma-delimited.csv" RESULTDATASET="reportData" />