File System - CSV to dataset
Declaration
<AMFILESYSTEM ACTIVITY="csv_to_dataset" SOURCE="text" RESULTDATASET="text" ROWASHEADER="YES/NO" DELIMITER="text (options)" />
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 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" then read the exported CSV onto a dataset and eventually import the dataset values onto the spreadsheet program.
General Parameters
Property |
Type |
Required |
Default |
Markup |
Description |
---|---|---|---|---|---|
Source |
Text |
Yes |
(Empty) |
|
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 (e.g., * or ?) may be used to to specify files matching a certain mask. |
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 Parameters
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, will treat the first line of CSV data as column headers. If set to NO, column headers are ignored. |
Delimiter |
Text (options) |
No |
(Empty) |
|
The character used to separate the tabular values in a CSV file. The available options are:
|
Description tab - A custom description can be provided on the Description tab to convey additional information or share special notes about a task step.
Error Causes tab - Specify how this step should behave upon the occurrence of an error. (Refer to Task Builder > Error Causes Tab for details.)
On Error tab - Specify what AWE should do if this step encounters an error as defined on the Error Causes tab. (Refer to Task Builder > On Error Tab for details.)
Example
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" />