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 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.
- (") double quotes
- (/) backslash
Parameters
General
Property | Type | Required | Default | Markup | Description |
---|---|---|---|---|---|
Source | Text | Yes | (Empty) |
|
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 will treat the first line of CSV data as column headers. If disabled, 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:
|
Example
- 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.
<AMFILESYSTEM ACTIVITY="csv_to_dataset" SOURCE="C:\temp\comma-delimited.csv" RESULTDATASET="reportData" />