A loop iterator is a variable that keeps track of the current iteration within a loop. It is used to control the number of times the loop executes and to access elements in a list or array during each iteration.

For instance, if you are looping through a list of items, the loop iterator will help you access each item one by one until the loop completes. The Loop package provides several iterator conditions to control the iteration of loops.
Table 1. Loop iterators
Iterator Description
For each row in CSV/TXT Repeats the set of actions for each row in the specified CSV or text file and assigns the values in the current row to a record variable. See Verwenden des Iterators „Für jede Zeile in CSV/TXT“.
For each row in Data Table Repeats the set of actions for each row in the specified table and assigns the values in the current row to a record variable. See Verwendung des Iterators „Für jede Zeile in der Tabelle“.
For each row in a SQL query dataset Repeats the set of actions for each row in the specified SQL query dataset and assigns the values in the current row to a record variable. Provide the session name that you have used to establish a connection with the database.
For each key in the Dictionary Repeats the set of actions for each key in the specified Dictionary variable and assigns the name of the current key to a variable.
Note: When a bot runs a Loop action that contains a Dictionary > Put action, the bot only iterates on the original number of items in a dictionary; it ignores items inserted using the Put action.
For each value in the Dictionary Repeats the set of actions for each value in the specified Dictionary variable and assigns the current value to a variable. Because this variable type can hold various subtypes (String, Number, Boolean, and so on), if you quick-create a variable when configuring the action, the variable is of Any type.
Note: When a bot runs a Loop action that contains a Dictionary > Put action, the bot only iterates on the original number of items in a dictionary; it ignores items inserted using the Put action.
For each mail in mailbox Repeats the set of actions for each email in the specified mailbox. See Verwendung des Iterators „Für jede E-Mail im Postfach“.
For each row in worksheet (Excel basic or Excel advanced) Repeats the set of actions for each row that contains data in a worksheet and assigns the values in the current row to a record variable. Provide the session name that you have used to open the Excel basic or Excel advanced worksheet. Specify whether to repeat the actions for all the rows, specified rows, or a specified cell range. Select a record variable from the Assign the current row to this variable list or create a new one. See Datensatzvariable.
This iterator retrieves cell values as string data types. It supports Excel cell formats, including Number, Percentage, Currency, Scientific, and Date. For example, a value from a cell of Currency formatting retains the currency symbol when passed to a table or record variable.
  • You must convert the values to perform non-string operations.
  • In Excel advanced, when you choose loop iterator as For each row in worksheet, you have a Read option to read either the visible text or value of the cell.

    For example, if the cell has 70% as cell content, Read cell value option will read the value as 70 ignoring the % format whereas Read visible text option will read the content as 70%.

    Recommendation: Use the Read cell value option as reading value from a cell for better performance than reading visible text.

Use of Global session option to share an Microsoft Excel session using the Excel advanced package is not available with this option.

Alternate solution: Use the Get multiple cells action and save the data into a datatable variable and then, use the Loop package with the Data Table option selected.

For each rows in table of spreadsheet

(Apple Numbers)

  • Use one of the following options to provide session name:
    • Session name: Enter the name of the session used to open the spreadsheet with the Open action.
    • Variable: Enter the session variable that you added in the Open action.
  • Specify the table name to retrieve the values.
  • Select any one of the following options to loop through:
    • All row: Select this option to extract all the data from the entire table, including every row and column within that table.
    • Specific rows: Select this option to extract data only from the specified row within the table. Complete the following fields:
      • From row: Specify the row number from which you want the value to be retrieved. For example, 10
      • To row: Specify the row number up to which you want the value to be retrieved. For example, 40
    • Cell range: Select this option to extract data from a specified rectangular block of cells defined by a starting and ending cell (for example, from B2 to D5). Complete the following fields:
      • From cell: Specify the cell address from which you want the value to be retrieved. For example, A1
      • To cell: Specify the cell address up to which you want the value to be retrieved. For example, C20
  • Choose from the Value type option to read either the visible text or value of the cell:
    • Visible text
    • Cell value

    For example, if the cell has 70% as cell content, Cell value option will read the value as 70 ignoring the % format whereas Visible text option will read the content as 70%.

  • In the Assign the current value to this variable field, select a record variable or create one to hold the output. Additionally, you can store the output in multiple variables by providing the key and the variable to which the key is mapped.
For each file in folder Repeats the set of actions for each file in the specified folder and assigns the properties of the current file to a Dictionary variable containing two keys: the name key holds the file name and the extension key holds the file extension.

To open files with different extensions, use the variable option to assign the folder path, file name, and file extension . First, create a variable for the folder path, $sFolder$. Then, for the files in the folder path, create two variables, one for file name $name$ and another for file extension $extension$. To open a file, combine the variables as a string, such as $sFolder$\$name$.$extension$. For the extension to work with different file types and different open options, you can add conditional logic.

For each folder in folder Repeats the set of actions for each folder in the specified folder and assigns the current folder name to a String variable.

Use the Include all sub-folders option to recursively iterate through each sub-folder within a folder including hidden folders.

For each item in the list Repeats the set of actions for each item in the specified list and assigns the current item to a variable. Specify whether to repeat the action for all items in the list or only for the range of items in the list. Because this variable type can hold various subtypes (String, Number, Boolean, and so on), if you quick-create a variable when configuring the action, the variable is of Any type.
Note: The index in a list starts from zero. For example, to repeat the action for items from the third position to the sixth position of the list, specify 2 and 5 in the appropriate fields.
For n times Repeats the actions in the container the specified number of times. You can assign the iteration count to a Number variable.
For each value in record Repeats the actions for each value in the specified record and assigns the current value to a variable. Because this variable type can hold various subtypes (String, Number, Boolean, and so on), if you quick-create a variable when configuring the action, the variable is of Any type.
For each meeting in calendar Use this option to repeat the set of actions for each meeting in the specified calendar. See Microsoft 365 Calendar-Aktionen in einer Schleife verwenden.
For each row in worksheet (Microsoft 365 Excel) Repeats the set of actions for each row that contains data in a worksheet.
  • Provide the session name that you have used to open the worksheet.
  • Specify whether to repeat the actions for all the rows or specific rows.
  • You can assign the values in the current row to a record variable.
For each mail in mailbox (Microsoft 365 Outlook) Repeats the set of actions for each email in the Microsoft 365 Outlook inbox.
  • Provide the session name that you have used in the Connect action.
  • Specify the status of the email that you want to use the iterator. For example, to use it on emails that you not yet read, select Unread.
  • Set the order in which you want the emails to be sorted by selecting one of the following options in the Sort email field:
    • Latest first: When the Microsoft 365 Outlook package version is updated to 1.6.1 or later, existing and new automations will have this setting enabled, and all the emails in the mailbox are sorted in the LIFO method by default.
    • Oldest first: This setting enables the FIFO method of sorting the emails in the mailbox. This setting is applicable for all Microsoft 365 Outlook actions that can be performed using loop iterators, such as:
      • Change status
      • Delete
      • Forward
      • Reply
      • Save attachments
      • Save email
  • Set the message format to either HTML or plain text.
  • Select a specific time zone.
For each work item in queue (Workload) Repeats the set of actions for each work item in a queue and assigns the work items to the Record variable. The Record variable returns three fixed key values namely workitemId, workitemValues, and workitemMetadata. See Verwenden des Iterators „Für jedes Aufgabenelement in der Warteschlange“
For each node in a XML dataset Repeats the set of actions for each node in an XML dataset and assigns the current node to String variable. Provide the session name that you have used to open the XML file.