UiPath StudioX Preview

Tutorial: Iterating through Rows in a Table

In this tutorial, we will create an automation to repeat the following workflow for every row in an Excel table that does not already have a value for the Transaction #:

  1. Copy the value from the cell in the Cash In column.
  2. Paste the value to a field in a desktop application.
  3. Copy the transaction number from the desktop application.
  4. Paste the value to the cell in the Transaction # column.
  5. Click a button in the desktop application to submit the data.

We will create a project and start by adding an Excel File Card to indicate the Excel file to use. Inside the card, we will add an Excel For Each Row activity to indicate that the activities should be repeated for each row as we iterate through them. Because we only want the automation to execute for the rows in our Excel file that do not contain a Transaction # value, we will add an If activity inside the Excel For Each Row activity to indicate that the activities to automate should only be executed for the rows that meet the condition that the Transaction # cell is empty.

Step 1: Set up the project and get the necessary files.

  1. Create a new project using the default settings.
  2. Download and extract the archive with the automation project in this tutorial using the button at the bottom of this page. Copy the file DoubleUI.xlsx to your project folder, and double-click the file DoubleUI.exe to open the DoubleUI application.

Step 2: Add the Excel file to the project.

  1. Click plus_icon on the Designer panel and then, in the Common Scenarios section of the search box at the top of the screen, double-click Use Excel File and browse to and select the file DoubleUI.xlsx. An Excel File Card activity is added to the Designer panel.
  2. In the activity, in the field And reference it later as enter UID.
    You have indicated that you will work on the file DoubleUI.xlsx that is known in your automation as UID.

Step 3: Iterate through the rows in the Excel file.

  1. Click plus_icon inside the Excel File Card and then, in the Common Scenarios section of the search box at the top of the screen, double-click Iterate through a table or range. An Excel For Each Row activity is added to the Designer panel inside the Excel File Card.
  2. In the Excel For Each Row activity, click plus button on the right side of the Range or table field, and then select UID > Input [Sheet] > Transactions[Table] to select the table Transactions from the Input sheet of the file UID. Your selection is displayed in the Range or table field as [UID] Transactions.
    You have indicated that you want to iterate through the rows in the Transactions table.

Step 4: Add the condition to be met for executing activities.

  1. Click plus_icon inside the Excel For Each Row activity and then, in the search box at the top of the screen, locate and double-click If. An If activity is added in the Application Card.
  2. In the If activity, click plus button on the right side of the Condition field, and then select Condition Builder.
  3. In the Condition Builder, add the condition "if the Transaction # in the current row is empty":
    • Click plus button on the right side of the field on the left, and then select Current Row > Transaction # to select the Transaction # value from the current row you are iterating through as the value to evaluate in the condition.
    • From the drop-down menu in the middle, select is empty.
      The activities you add in the Then branch of the If activity will be executed for the rows that meet this condition.

Step 5: Add the desktop application and the activities to perform in it if the condition is met.

  1. Click plus_icon inside the Then branch of the If activity and then, in the search box at the top of the screen, locate and double-click Application Card. An Application Card is added in the Then branch of the If activity.
  2. In the Application Card activity, click Configure Window and then move the mouse pointer inside the DoubleUI window. When the window is highlighted, click anywhere in DoubleUI.
    The Application Card is updated and a screenshot of the application window appears inside the activity.
  3. Click plus_icon inside the Application Card activity and then, in the search box at the top of the screen, locate and double-click Type Into. A Type Into activity is added in the Application Card activity.
  4. In the Type Into activity:
    • Click Indicate Target, then move the mouse pointer on the Cash In field in the DoubleUI.exe application and, when it is highlighted, click the field. Make sure to click the field where you can type, not the Cash In label next to it. In the Type Into activity, an image of the label of the field is displayed under Find this and an image of the field where to type is displayed under Type here.
      You have indicated that you want to type into the field Cash In from the DoubleUI.exe application.
    • Click plus button on the right side of the Type this field, and then select Current Row > Cash In to select the Cash In value from the current row you are iterating through as the value to type.
  5. Click plus_icon inside the Application Card activity below the Type Into activity and then, in the search box at the top of the screen, locate and double-click Get Text. A Get Text activity is added in the Application Card activity after the Type Into activity.
  6. In the Get Text activity:
    • Click Indicate Target, then move the mouse pointer on the Transaction # value in the DoubleUI.exe application and, when it is highlighted, click the value. Make sure to click the value next to the Transaction # label, not the label itself. In the Get Text activity, an image of the label of the field is displayed under Find this and an image of the value is displayed under Get this.
      You have indicated that you want to copy the value for the Transaction # from the DoubleUI.exe application.
    • Click plus button on the right side of the Save to field, and then select Current Row > Transaction # to select the Transaction # column on the current row you are iterating through as the cell where to paste the value copied from the application.
  7. Click plus_icon inside the Application Card activity below the Get Text activity and then, in the search box at the top of the screen, locate and double-click Click.
    A Click activity in the Application Card activity after the Get Text activity.
  8. In the Click activity, click Indicate Target, then move the mouse pointer on the Accept button in the DoubleUI.exe application and, when it is highlighted, click the button. In the Click activity, an image of the button is displayed under Click on this.
    You have indicated that you want to click the Accept button from the DoubleUI.exe application.
  1. Click Save in the ribbon menu to save the automation, then click Run to execute the automation.

The Cash In values from each row in the UID table that has no Transaction # value are entered in the DoubleUI application and the Transaction # from the DoubleUI application is copied to each row in the UID table.

Download example


Tutorial: Iterating through Rows in a Table


Suggested Edits are limited on API Reference Pages

You can only suggest edits to Markdown body content, but not to the API spec.