Write To CSV
Description
Writes data from a DataTable to a CSV file and returns a File Reference to the created or updated file.
The activity supports configurable delimiters, text encodings, optional column headers, and file overwrite or append behavior.
Use it to export a DataTable produced by an earlier activity, including the selected and computed columns returned by Read From CSV.
Common Capabilities
Process Data Support
This activity supports dynamic configuration using variables from the Process Data drawer.
You can bind values from Agent Data, Workflow Data, Form Data, System Data, Enterprise Variables, and Activity Outputs.
Learn more → Using Process Data
Design-Time Configuration
Configure the activity
- Set Target Folder to the destination folder reference and enter File Name.
- Bind Data Table to the DataTable you want to export.
- Select the Delimiter and Encoding required by the application that will use the CSV file.
- Set Include Column Names to control whether the file includes a header row.
- Choose If File Exists to replace existing content or append rows.
After execution, use the output File Reference in subsequent activities to access the CSV file.
Display Text
The label for this activity as it appears on the workflow canvas.
Target Folder
A FolderReference identifying the destination folder where the CSV file will be created or updated.
File Name
The name of the file to create or update in Target Folder. The .csv extension is added automatically. Supports Liquid expressions for dynamic file names.
Data Table
The source DataTable whose rows will be written to the CSV file.
Prepare the required columns and values in this DataTable before writing. To export only selected columns or include calculated values, configure the source DataTable accordingly.
Delimiter
Specifies the character used to separate fields in the CSV file.
Supported values:
- Comma (,)
- Semicolon (;)
- Tab
- Pipe (|)
Encoding
Specifies the text encoding used when writing the file.
Supported values include:
- UTF-8
- UTF-16
- UTF-16BE
- ASCII
- ISO-8859-1
- Windows-1252
Include Column Names
Determines whether DataTable column names are written as the first row of the CSV file.
The header comes from the DataTable's column names; the first data row remains a data row. When disabled, the file contains data rows without a header.
If File Exists
Determines how the activity behaves when the target file already exists.
Supported values:
- Overwrite Existing Content – Replaces the existing file contents with the current DataTable contents. Previous rows are discarded.
- Append Content – Appends DataTable rows to the end of the existing file.
When appending to an existing file, only data rows are appended. Column headers are not written again, even when Include Column Names is enabled.
Before appending, ensure that the DataTable's columns match the existing file's columns in number, order, and meaning. Use the same delimiter and encoding as the existing file to keep the output consistent.
Properties
Input
| Property | Type | Description |
|---|---|---|
| Target Folder | FolderReference | Destination folder |
| File Name | String | Name of the CSV file |
| Data Table | DataTable | Data to write |
| Delimiter | String | Field separator |
| Encoding | String | Text encoding |
| Include Column Names | Boolean | Writes DataTable column names as a header, except when appending to an existing file |
| If File Exists | String | Controls overwrite or append behavior |
Output
| Property | Type | Description |
|---|---|---|
| File Reference | FileReference | Reference to the created or updated CSV file for use in subsequent activities |
| Total Rows | Integer | Number of data rows written |
Example
Suppose the source DataTable contains:
| Customer | Amount |
|---|---|
| Northwind | 125.50 |
| Contoso | 80.00 |
Set File Name to SalesExport, select a comma delimiter and UTF-8 encoding, enable Include Column Names, and choose Overwrite Existing Content. With the destination folder configured, the activity writes SalesExport.csv with a header followed by the two data rows:
Customer,Amount
Northwind,125.50
Contoso,80.00
The output File Reference identifies the exported file, and Total Rows is 2.