UiPath Documentation
studiox
2024.10
true

StudioX user guide

最終更新日時 2026年4月30日

チュートリアル: 表の行を反復処理する

このチュートリアルでは、Excel の表で Transaction # の値がまだ入力されていないすべての行ごとに、以下のワークフローを繰り返すオートメーションを作成します。

  1. Cash In 列のセルから値をコピーします。
  2. この値をデスクトップ アプリケーションのフィールドに貼り付けます。
  3. デスクトップ アプリケーションからトランザクション番号をコピーします。
  4. この値を Transaction # 列のセルに貼り付けます。
  5. デスクトップ アプリケーションのボタンをクリックしてデータを送信します。

We will create a project and start by adding a Use Excel File activity to indicate the Excel file to use. Inside this activity, we will add a For Each Excel 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 For Each Excel 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.

  1. プロジェクトを設定し、必要なファイルを取得します。
    1. Create a new blank project using the default settings.
    2. このチュートリアルでは、このページ下部にあるボタンを使用して、オートメーション プロジェクトを収めたアーカイブをダウンロードして展開します。ファイル DoubleUI.xlsx をプロジェクト フォルダーにコピーし、ファイル DoubleUI.exe をダブルクリックして DoubleUI アプリケーションを開きます。
  2. Excel ファイルをプロジェクトに追加します。
    1. Click Add Activity ドキュメントの画像 in the Designer panel, and then find the Use Excel File activity in the search box at the top of the screen and select it. A Use Excel File activity is added to the Designer panel.
    2. アクティビティで次の操作を行います。
      • Click Browse ドキュメントの画像 next to the Excel file field, and then browse to and select the file DoubleUI.xlsx

      • [参照名] フィールドに「UID」と入力します。

        これで、このオートメーションでは名前を UID としたファイル DoubleUI.xlsx を操作対象として指定したことになります。

  3. Excel ファイルの行に対して反復処理する
    1. Click Add Activity ドキュメントの画像 inside Use Excel File, and then, in the Common Scenarios section of the search box at the top of the screen, click Repeat actions for rows in Excel range. A For Each Excel Row activity is added to the Designer panel inside the Use Excel File activity.

    2. In the For Each Excel Row activity, click Plus ドキュメントの画像 on the right side of the In range 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 In range field as [UID] Transactions.

      これで、Transactions 表の行に対して反復処理を実行するように指定したことになります。

  4. アクティビティを実行するために満たす必要がある条件を追加する
    1. Click Add Activity ドキュメントの画像 inside the For Each Excel Row activity and then, in the search box at the top of the screen, locate and click If. An If activity is added in the Use Application/Browser activity.
    2. In the If activity, select ドキュメントの画像 Open in Advanced Editor next to the Condition field to open the Condition Builder.
    3. 次の手順に従い、条件ビルダーに条件として「現在の行の Transaction # が空の場合」を追加します。
      • Click Plus ドキュメントの画像 on the right side of the field on the left, and then select CurrentRow > Transaction # to select the Transaction # value from the current row you are iterating through as the value to evaluate in the condition.

      • 中央のドロップダウン メニューから、[空] を選択します。

        この条件を満たす行について、[条件分岐 (if)] アクティビティの [Then] 分岐に追加したアクティビティが実行されます。

        ドキュメントの画像

  5. デスクトップ アプリケーションを追加し、条件が満たされたときにそのアプリケーションで実行するアクティビティを追加する
    1. Click Add Activity ドキュメントの画像 inside the Then branch of the If activity and then, in the search box at the top of the screen, locate and click Use Application/Browser. A Use Application/Browser activity is added in the Then branch of the If activity.

    2. [アプリケーション/ブラウザーを使用] アクティビティで [画面上でターゲットを指定] をクリックしてから、DoubleUI のウィンドウ内部にマウス ポインターを移動します。ウィンドウが強調表示されるので、DoubleUI の任意の場所をクリックします。

      [アプリケーション/ブラウザーを使用] アクティビティが更新され、アプリケーション ウィンドウのスクリーンショットがアクティビティに表示されます。

    3. Click Add Activity ドキュメントの画像 inside the Use Application/Browser activity and then, in the search box at the top of the screen, locate and click Type Into. A Type Into activity is added in the Use Application/Browser activity.

    4. [文字を入力] アクティビティで次の操作を行います。

      • [画面上でターゲットを指定] をクリックし、DoubleUI.exe アプリケーションの [Cash In] フィールドにマウス ポインターを移動します。フィールドが強調表示されたらクリックします。テキスト フィールドがターゲットとして、フィールドの横の [Cash In] ラベルがアンカーとして識別されます。[選択オプション] ウィンドウの [確認] をクリックして選択内容を保存します。ターゲットとアンカーの画像が [文字を入力] アクティビティに表示されます。

        これで、DoubleUI.exe アプリケーションの [Cash In] フィールドに文字を入力するように指定したことになります。

      • Click Plus ドキュメントの画像 on the right side of the Type this field, and then select CurrentRow > Cash In to select the Cash In value from the current row you are iterating through as the value to type.

    5. Click Add Activity ドキュメントの画像 inside the Use Application/Browser activity below the Type Into activity and then, in the search box at the top of the screen, locate and click Get Text. A Get Text activity is added in the Use Application/Browser activity after the Type Into activity.

    6. [テキストを取得] アクティビティで、次の操作を行います。

      • [画面上でターゲットを指定] をクリックし、DoubleUI.exe アプリケーションの [Transaction #] の値にマウス ポインターを移動します。値が強調表示されたらクリックします。[Transaction #] の値がターゲットとして、値の横のラベルがアンカーとして識別されます。[選択オプション] ウィンドウの [確認] をクリックして選択内容を保存します。ターゲットとアンカーの画像が [テキストを取得] アクティビティに表示されます。

        これで、DoubleUI.exe アプリケーションの [Transaction #] の値をコピーするように指定したことになります。

      • Click Plus ドキュメントの画像 on the right side of the Save to field, and then select CurrentRow > 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 Add Activity ドキュメントの画像 inside the Use Application/Browser activity below the Get Text activity and then, in the search box at the top of the screen, locate and select Click.

      これにより、[アプリケーション/ブラウザーを使用] アクティビティで [テキストを取得] アクティビティの後に [クリック] アクティビティが追加されます。

    8. [クリック] アクティビティで [画面上でターゲットを指定] をクリックし、DoubleUI.exe アプリケーションの [Accept] ボタンにマウス ポインターを移動します。ボタンが強調表示されたらクリックします。[Accept] ボタンがターゲットとして、[Cancel] ボタンがアンカーとして識別されます。[選択オプション] ウィンドウの [確認] をクリックして選択内容を保存します。ターゲットとアンカーの画像が [クリック] アクティビティに表示されます。

      これで、DoubleUI.exe アプリケーションの [Accept] ボタンをクリックするように指定したことになります。

      ドキュメントの画像

    9. Click Save in the StudioX ribbon 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

このページは役に立ちましたか?

接続

ヘルプ リソース サポート

学習する UiPath アカデミー

質問する UiPath フォーラム

最新情報を取得