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 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 uses the following characters as text qualifiers and will not be read into a dataset or variable:

  • (") double quotes

  • (/) backslash

Parameters

General

Property

Type

Required

Default

Markup

Description

Source

Text

Yes

(Empty)

  1. SOURCE="c:\sourcefolder\file.csv"

  2. SOURCE="filename.csv"

The path and filename of the .csv file to read data from. This can be a fully qualified path and filename (preferred) or a /filename only (requires use of the Change Folder activity). Wildcard characters (i.e. * or ?) may be used to specify files matching a certain mask. See File Masks & Wildcards for more details.

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. More about the individual dataset fields that this activity creates can be found below under Datasets.

Advanced

Property

Type

Required

Default

Markup

Description

Treat first line of data as column headers

Yes/No

No

No

ROWASHEADER="YES/NO"

If set to YES, AutoMate will treat the first line of CSV data as column headers. If set to NO, column headers are ignored.

Delimiter

Text (options)

No

(Empty)

  1. DELIMITER="comma"

  2. DELIMITER="semicolon

  3. DELIMITER="tab"

  4. DELIMITER="space"

  5. 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: The sample AML code below can be copied and pasted directly into the Steps panel of the Task Builder.

Description:

Save CSV file C:\temp\comma-delimited.csv (comma delimited) into dataset reportData.

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