|
File System - Dataset to CSV |
Declaration
<AMFILESYSTEM ACTIVITY="dataset_to_csv" DESTINATION="text" RESULTDATASET="text" DELIMITER="text (options)" OVERWRITE="YES/NO" WRAPCELLS="YES/NO" />
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). Wildcard characters (for example, * or ?) may be used to specify all files matching a certain mask. Multiple files and/or file masks can be specified 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 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 |
|
Specifies the delimiter to use to separate the cell values in the CSV file. The options are:
|
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. |
Example
- The sample AML code below can be copied and pasted directly into the Steps Panel of the Task Builder.
- Parameters containing user credentials, files, file paths, and/or other information specific to the task must be customized before the sample code can run successfully.
Description
This sample task retrieves folder information and populates a dataset with results. The dataset is then written to a CSV file.
<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" />