---
schema_version: "1"
id: 998934140a8bba1dda6368fb1a2756ce60bc1feb7ce22bea6ad39912a287917b
title: File Controlled Loop
collection: mulesoft
version: current
locale: en-us
portal_url: https://docs.salesforce.com/mulesoft/current/en-us/rpa-builder/latest/toolbox-flow-control-file-controlled-loop.md
canonical_url: https://docs.mulesoft.com/rpa-builder/latest/toolbox-flow-control-file-controlled-loop
source_site: docs.mulesoft.com
content_type: documentation
content_hash: 1d7dd9858f02abf31b2a9f5f32370e57d23e1b14cd14ecb91ab71dd0b74b96b1
description: MuleSoft Documentation Site
release: "6.7"
latest: true
---
---
product: RPA Builder
version: 6.7
is-latest-version: true
---

# File Controlled Loop

> For the full documentation index, see: https://docs.mulesoft.com/llms.txt

This _Flow Control Element_ reads data from a CSV file and makes the data available as variables,
whereby each column represents one variable. During execution, _File Controlled Loop_ iterates over
each row of data and runs through all the content of each row individually.

Ensure you use a valid and well-formatted CSV file where all rows have the same number of columns
separated by the selected separation character. RPA Builder selects the semicolon (`;`) as the
separation character when it converts existing workflows created with earlier versions. If the file
has an incorrect format, _File Controlled Loop_ cannot read the file.

The first line of the file is considered the header line. _File Controlled Loop_ uses these headers
as variable names and not as actual variable values.

## Properties

- **External File**

  - **Import Filename**

    Full path of the file to import.

  - **Relative to 3rd Party Folder**

    Specifies if the path of the file to load is relative to the _3rd party_ folder.

  - **Separation character**

    Specifies the character to use as a column separator when reading the CSV file.

  - **Shuffle**

    Shuffles the data rows during execution.

- **Miscellaneous**

  - **Iteration Count**

    If **Limit iterations** is selected, this property specifies the maximum iterations the loop
    does. Only applicable when the file is imported at runtime.

  - **Limit iterations**

    Decides if the iteration count is limited.

Only applicable when the file is imported at runtime. **\* \*Separate File Path for Execution**

\+ When **Use separate File Path for Execution** is selected, _File Controlled Loop_ reads the file
from this path instead of the path given in **Import Filename**. Only applicable when the file is
imported at runtime. **\* \*Use separate File Path for Execution**

\+ Select this setting to load the file from a different path during execution. Useful if you want
to read the file from a network location. Only applicable when the file is imported at runtime. **\*
\*Use type string only**

\+ Converts all data to type String during runtime. In the wizard, you can convert the data per
column.

## Inbound Variables

The action step File Controlled Loop has no Inbound variables.

## Outbound Variables

The action steps inside _File Controlled Loop_ return the respective column contents as variables.

The names of the variables follow the pattern `<action step name>.<column name>`.

## Wizard

The wizard enables you to select whether to import the file at the moment or during execution, the
separation character, and the document’s encoding, including Shift-JIS and EUC-JP for Japanese
support.

Depending on the read mode you select, the wizard changes. The main difference between the two modes
is that when you import the file at design time, you can use its variables in timers, and the data
is fixed. If you import the file during execution, you can read the file from anywhere, including
network locations, which enables you to alter the data without modifying the _Workflow_ at all
(however, you cannot use the variables within timer names).

If you switch between the two modes you lose all defined variable mappings.

Importing the file during execution enables you to use variables within the column filters. However,
the wizard deletes any filters that contain variables if you switch modes.

### Importing a File at Design Time

When you select **Read file now**, the wizard shows the following configuration options:

![The File Controlled Loop wizard showing the file preview when Read file now is selected](/mulesoft/current/en-us/rpa-builder/latest/_images/file-controlled-loop-wizard-read-file-now.png)

Click **Import File** to select the file to import. RPA Builder then reads and analyzes the file and
displays a content preview in the **File Content Preview** section of the wizard.

The **File Content Preview** section enables you to apply filters to each column by clicking the
**Filter** button (![The filter icon](/mulesoft/current/en-us/rpa-builder/latest/_images/filter-icon.png)). When you enter text in the
**Filter** field, the preview filters out all rows that do not contain the specified text.

![The filter dialog of the File Controlled Loop action step](/mulesoft/current/en-us/rpa-builder/latest/_images/file-controlled-loop-filter-dialog.png)

Select **Use Regex** to use a regular expression instead of plain text when applying filters.

Use the drop-down menu next to each column name to change the type of the column content.

### Importing a File During Execution

When you select **Read file dynamically during Workflow execution**, the wizard shows the following
configuration options:

![The File Controlled Loop wizard showing the file preview when Read file dinamically during Workflow execution is selected](/mulesoft/current/en-us/rpa-builder/latest/_images/file-controlled-loop-read-file-during-execution.png)

Click **\[…​\]** next to the **File Name** field to specify the file path, select and copy the file
to the _3rd Party_ folder, or open the _3rd Party_ folder.

Select **Use separate File Path during Script Execution** to specify an absolute path to read the
file from. Use this option when the file’s location differs in the system that executes the
automation and the system where you build the Workflow.

Select **Only read a maximum of <n> Records** and specify a number to limit the maximum number of
rows to read from the file.

## See Also

- [Using Variables](https://docs.mulesoft.com/rpa-builder/latest/advanced-concepts-using-variables)
