Skip to main content
Version: Current

Read From CSV

Description​

Reads data from a CSV file referenced by a File Reference and returns the contents as a DataTable.

You can read all rows or a specific page of rows, select the CSV columns to include, rename and convert columns, and add computed columns. Use a representative CSV file as a design-time template to define and preview the output structure before running the workflow.


Common Capabilities​

Process Data Support​

info

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​

Display Text​

The label for this activity as it appears on the workflow canvas.

File Reference​

A FileReference pointing to the CSV file to read.

The file can originate from supported storage providers, email attachments, or outputs from previous workflow activities.

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 reading the file.

Supported values include:

  • UTF-8
  • UTF-16
  • UTF-16BE
  • ASCII
  • ISO-8859-1
  • Windows-1252

Include Column Names​

Indicates whether the first row contains column headers.

When enabled, the first row is used as column names and is not included in the returned data.

Read All​

Determines whether all rows are read from the file.

When disabled, paging options become available.

Page Number​

The 1-based page number to read.

Available only when Read All is disabled.

Page Size​

The number of rows to read per page.

Available only when Read All is disabled.

Table Definition​

Defines the columns to include in the output DataTable. You can select source CSV columns, give them different output names, set their data types, and add transformations or computed columns.

Configure from a CSV template​

A CSV template is a representative file with the same structure as the files the workflow will process. Use it to configure the activity at design time; File Reference identifies the file to read when the workflow runs. Choose a template whose column layout, headers, and value formats match the runtime files.

  1. Click Design to open the activity configuration. In Inputs, configure the file, encoding, delimiter, and Include Column Names setting.
  2. Open Table Definition and click Detect to open Auto detect settings.
  3. Select the Connection type and Template file connection, then use File path to select the CSV template.
  4. Set Rows to infer datatype to the number of sample rows to examine. The dialog shows 500 rows; increasing this value can improve type detection but takes longer. This setting controls design-time inference, not the number of rows read during execution.
  5. Select First line represents CSV column names if the template has a header row. Keep this consistent with Include Column Names in Inputs. Click Apply settings to populate the table definition.
  6. Keep mappings for the CSV columns you need and remove unwanted mappings using Actions. Set the output column names and types. Use Add Column for additional mapped or computed columns.
  7. Click Preview to inspect the template data with the current configuration. Review the selected columns, output names, types, and transformed values, then click OK to save.

Detection provides a starting point. Review the inferred types, especially when a column contains mixed values or the sampled rows do not represent the entire file.

Column mappings​

To read only selected CSV columns, retain a mapping for each column you want in the output. Source columns without a mapping are excluded from the defined output structure.

Each definition includes:

PropertyDescription
CSV ColumnSource column from the CSV file
DataTable ColumnDestination column name in the DataTable
TypeTarget data type
TransformOptional Liquid expression to transform a source value or calculate a new value for each row

Supported data types:

  • String
  • Int32
  • Int64
  • Decimal
  • Double
  • Boolean
  • DateTime

Computed columns​

Use Add Column to create an output column that does not exist in the CSV. Leave its CSV Column unset, specify its DataTable Column name and Type, and enter a Liquid expression in Transform.

The expression is evaluated for each row. It can combine existing CSV values or calculate a value using a formula. Choose an output type appropriate for the result.

During execution, the current row is available through the csvRow object.

For example, create a String column named FullName from the source columns FirstName and LastName:

{{ csvRow.FirstName }} {{ csvRow.LastName }}

To create a numeric LineTotal column from Quantity and UnitPrice, choose Decimal and use:

{{ csvRow.Quantity | times: csvRow.UnitPrice }}

The output can therefore contain selected source columns together with calculated values needed by later activities.

Table definition controls​

ControlPurpose
DetectSelect a CSV template and infer its columns and data types.
PreviewInspect template data using the current parsing and mapping configuration.
ClearRemove all configured column mappings.
Add ColumnAdd a mapped or computed output column.

Select rows to read​

Use Read All to read every data row. To read a specific group of rows, turn Read All off and set Page Number and Page Size in Inputs.

For example, Page Number 2 and Page Size 100 select data rows 101–200, or the remaining rows if the file ends sooner. When Include Column Names is enabled, the header row is excluded from these data row numbers. Paging selects a contiguous group of rows; it does not specify a condition on column values.


Properties​

Input​

PropertyTypeDescription
File ReferenceFileReferenceCSV file to read
DelimiterStringField separator
EncodingStringText encoding
Include Column NamesBooleanUses first row as column headers
Read AllBooleanReads all rows
Page NumberIntegerPage to read when paging is enabled
Page SizeIntegerRows per page when paging is enabled

Output​

PropertyTypeDescription
Data TableDataTableSelected rows with the mapped and computed columns defined in Table Definition
Total RowsIntegerTotal number of rows in the CSV file