File System - Dataset to CSV

Declaration

<AMFILESYSTEM ACTIVITY="dataset_to_csv" DESTINATION="text" RESULTDATASET="text" DELIMITER="text (options)" OVERWRITE="YES/NO" WRAPCELLS="YES/NO" />

Related Topics    

Description

Retrieves data currently populated in a dataset and outputs the data onto a comma-separated values (CSV) file.

Practical usage

Used to automate the movement of data between programs that natively operate on incompatible (often proprietary) formats. For example, a user may need to transfer data previously populated onto a dataset (with the use of the CSV to dataset activity), and output the data onto a new CSV file.

Parameters

General

Property Type Required Default Markup Description
Dataset Text Yes (Empty) RESULTDATASET="myDataset" The name of the dataset from which to extract data.
Destination Text Yes (Empty) DESTINATION="c:\temp\file.csv" The path and file name of the CSV file in which to output the data. This can be a fully qualified path and file name (preferred) or a single file (requires use of the File System - Change folder activity). You can use wildcard characters (for example, * or ?) to specify all files matching a certain mask. You can specify multiple files and file masks by separating each entry with a pipe character (|) (for example, c:\temp\*.txt|c:\backup\*.bak). See File Masks & Wildcards for more details.
Overwrite if file already exists Yes/No No No OVERWRITE="YES" If selected, matching destination files are overwritten. If disabled (default), matching files are not overwritten, however, an error occurs when a matching file exists.

Advanced

Property Type Required Default Markup Description
Include column names Yes/No No Yes INCLUDECOLUMNNAMES="NO" If selected, Automate Desktop sets the first line of the CSV file as column headers. If disabled, column headers are ignored.
Quote cells Yes/No No No WRAPCELLS="YES" If selected, each cell value within the dataset is enclosed in double quotes in the CSV file (for example, "apple"). If disabled, double quotes are omitted.
Delimiter Text (options) Yes Comma
  • DELIMITER="semi_colon"
  • DELIMITER="tabulation"
  • DELIMITER="space"
Specifies the delimiter to use to separate the cell values in the CSV file. The options are:
  • Comma (default) - Separates each cell value using a comma.

  • Semicolon - Separates each cell value using a semicolon.

  • Tab - Separates each cell value using a tab character.

  • Space - Separates each cell value using a single space.

  • Custom - Separates each cell value using one or more characters of choice (for example, |).

Custom delimiter text Text No (Empty) DELIMITER="|" The custom characters used to separate each cell value in the CSV file. This parameter becomes active if Delimiter is set to Custom.

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 retrieves folder information and populates a dataset with results. The dataset is then written to a CSV file.

Copy
<AMFILESYSTEM ACTIVITY="get" MODE="folder" SOURCE="C:\temp" RESULTDATASET="theFolderInfo" FILEPROPERTY="fullname" />
<AMFILESYSTEM ACTIVITY="dataset_to_csv" DESTINATION="c:\temp3\theFolderInfo.csv" RESULTDATASET="theFolderInfo" OVERWRITE="YES" />