UiPath Documentation
studiox
2023.10
false

StudioX ユーザー ガイド

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

チュートリアル: Excel データを使用して Acrobat Reader の PDF フォームに入力する

このチュートリアルでは、会社の新しく入ってきた各従業員用に機器の使用契約の PDF フォームを作成するオートメーション プロジェクトを作成します。オートメーション プロジェクトは、テンプレート フォームから各従業員用のフォームを作成し、それぞれの従業員に配布される機器に関する情報が記載された Excel のデータをそのフォームに入力します。

はじめに、PDF ファイルを保存するフォルダーを作成する [ フォルダーを作成 ] アクティビティを追加します。次に、[ Excel ファイルを使用] アクティビティを中に含む [ アプリケーション/ブラウザーを使用] アクティビティを追加します。これらは、Acrobat Reader で開かれるテンプレート ファイルと、機器データを含む Excel ファイルをオートメーションに追加します。[Excel ファイルを使用] の中に、ファイルを行ごとに処理する [ 繰り返し (Excel の各行 )] アクティビティを追加します。この [繰り返し (Excel の各行)] では、一連の [文字を入力 ] アクティビティが各行のセルのデータを PDF フォームにコピーし、[ キーボード ショートカット]、[ クリック]、[文字を入力] の各アクティビティが、Acrobat Reader で従業員ごとに個別の PDF を作成するために必要なタスクを実行します。

  1. プロジェクトを設定し、必要なファイルをダウンロードします。
    1. 既定の設定を使用して新しい空のプロジェクトを作成します
    2. このチュートリアルでは、このページ下部にあるボタンを使用して、オートメーション プロジェクトを収めたアーカイブをダウンロードして展開します。EquipmentAgreement.pdf および Employees.xlsx ファイルをプロジェクト フォルダーにコピーし、PDF ファイルをダブルクリックして Acrobat Reader で開きます。
    3. Acrobat Reader で [ページ レイアウト][単一ページ] に設定し、[ズーム]既定のままに設定します。これは、オートメーション プロジの実行時に、画面にフォーム全体が表示されてロボットがそこに入力できるようにするためです。Acrobat Reader DC では、これらの設定を [編集] > [環境設定...] > [ページ表示] を選択することで変更できます。
      注:

      Acrobat Reader 内の要素を指定する際に問題が発生する場合は、『Studio ガイド』の 「アクセシビリティ オプションが有効な PDF 内の UI 要素を識別する 」に記載されているように、ドキュメントのアクセシビリティ オプションを更新してください。

  2. フォルダーを作成してファイルをプロジェクトに追加する
    1. Click Add Activity ドキュメントの画像 in the Designer panel, and then find the Create Folder activity in the search box at the top of the screen and select it. The activity is added to the Designer panel.

    2. In the Create Folder activity, click Plus ドキュメントの画像 on the right side of the Folder name field, and then select Text. In the Text Builder, enter EquipmentAgreements.

      これで、プロジェクト フォルダーに EquipmentAgreements という名前のフォルダーを作成するように指定したことになります。

    3. Click Add Activity ドキュメントの画像 below Create Folder, and then find the Use Application/Browser activity in the search box at the top of the screen and select it. The activity is added to the Designer panel.

    4. [アプリケーション/ブラウザーを使用] アクティビティで、次の操作を行います。

      • [アプリケーションを指定] をクリックして、マウス ポインターを PDF ファイルが開かれている Acrobat のウィンドウに移動します。ウィンドウが青く強調表示されたら、ウィンドウ内の任意の場所をクリックします。

        [アプリケーション/ブラウザーを使用] アクティビティが更新され、ウィンドウのスクリーンショットがアクティビティに表示されます。また、実行可能ファイルのパスが [アプリケーション パス] フィールドに表示されます。

      • Click Plus ドキュメントの画像 on the right side of the Application Arguments field, and then select Text. In the Text Builder, enter EquipmentAgreement.pdf.

        これで、オートメーションにおいて EquipmentAgreements.pdf ファイルを Adobe Acrobat で開くように指定したことになります。

    5. Click Add Activity ドキュメントの画像 inside Use Application/Browser, and then find the Use Excel File activity in the search box at the top of the screen and select it. The activity is added to the Designer panel.

    6. [Excel ファイルを使用] アクティビティで次の操作を行います。

      • Click Browse ドキュメントの画像 next to the Excel file field, and then browse to and select the file Employees.xlsx.

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

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

  3. アクティビティを追加し、Excel ファイルの各行に反復処理を実行する
    1. Click Add Activity ドキュメントの画像 inside Use Excel File, and then find the For Each Excel Row activity in the search box at the top of the screen and select it. The activity is added to the Designer panel.

    2. [繰り返し (Excel の各行)] アクティビティで、次の操作を行います。

      • Click Plus ドキュメントの画像 on the right side of the In range field, and then select EmployeeData > Sheet1 [Sheet]

      • [繰り返し] フィールドに「Employee」と入力します。

        これで、EmployeeData ファイルの Sheet1 の各行に対してアクティビティを繰り返すように指定したことになります。各行には 1 名の従業員に関するデータが含まれているため、Employee という名前で参照されます。これは、オートメーションで行に含まれるデータを後で選択しやすくするためです。

    3. Click Add Activity ドキュメントの画像 inside For Each Excel Row, and then find the Type Into activity in the search box at the top of the screen and select it. The activity is added to the Designer panel.

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

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

      • Click Plus docs image on the right side of the Type this field, and then select Employee > First Name.

        これで、各従業員について、First Name 列の値をコピーし、PDF フォームの [First Name] フィールドに貼り付けるように指定したことになります。

    5. 既存の [文字を入力] アクティビティの下に、さらに 4 つの [文字を入力] アクティビティを追加します。ステップ 3 ~ 4 の説明に従い、各従業員の Last Name (姓)、Role in Company (職務)、Equipment Model (機器モデル)、Equipment Serial No (機器シリアル番号) をコピーして PDF フォームの対応するフィールドに貼り付けるようにアクティビティを設定します。

    6. 最後の [テキストを入力] アクティビティの後ろの [繰り返し (Excel の各行)] の中に、6 番目となる [テキストを入力] アクティビティを追加します。

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

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

      • Click Plus docs image on the right side of the Type this field, and then select Text.

        テキスト ビルダーで、Excel ファイルの各従業員の姓名を含むテキストをスペースで区切って入力します。

        1. Click Plus ドキュメントの画像 on the right side, and then select Employee > First Name.

        2. スペースを追加します。

        3. Click Plus ドキュメントの画像 on the right side, and then select Employee > Last Name.

        4. [保存] をクリックします。

          これで、各従業員について、First Name 列と Last Name 列の値をコピーし、PDF フォームの [Full Name] フィールドに貼り付けるように指定したことになります。

      1. 最後の [テキストを入力] アクティビティの後ろの [繰り返し (Excel の各行)] の中に、7 番目となる [テキストを入力] アクティビティを追加します。
    8. 最後の [テキストを入力] アクティビティの後ろの [繰り返し (Excel の各行)] の中に、7 番目となる [テキストを入力] アクティビティを追加します。

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

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

      • Click Plus docs image on the right side of the Type this field, and then select Notebook > Date [Sheet] > Today [Cell].

        これで、各従業員について、プロジェクト ノートブックのセルから今日の日付をコピーし、PDF フォームの [Date] フィールドに貼り付けるように指定したことになります。

    10. Click Add Activity ドキュメントの画像 below the last Type Into activity inside For Each Excel Row and then find the Keyboard Shortcuts activity in the search box at the top of the screen and select it. The activity is added to the Designer panel.

    11. [キーボード ショートカット] アクティビティ内の [ショートカットを記録] をクリックして、キーボードの Ctrl + Shift + S キーを押します。

      これで、Ctrl + Shift + S キーを押すと PDF ファイルが保存されるように指定したことになります。オートメーション プロジの実行時に、このキーの組み合わせを押すと、Acrobat Reader の [名前を付けて保存] ダイアログが開きます。

    12. Acrobat Reader のファイルを開いたウィンドウでキーボードの CTRL SHIFT S を押して、[名前を付けて保存] ダイアログを開きます。

    13. In StudioX, click Add Activity ドキュメントの画像 below the Keyboard Shortcuts activity inside For Each Excel Row, and then find the Click activity in the search box at the top of the screen and select it. The activity is added to the Designer panel.

    14. [クリック] アクティビティで [画面上でターゲットを指定] をクリックし、[名前を付けて保存] ダイアログの [別のフォルダーを選択] ボタンにマウス ポインターを移動します。ボタンが強調表示されたらクリックします。ボタンがターゲットとして、ボタンの横の [キャンセル] ボタンがアンカーとして識別されます。[選択オプション] ウィンドウの [確認] をクリックして選択内容を保存します。ターゲットとアンカーの画像が [クリック] アクティビティに表示されます。

      これで、[別のフォルダーを選択] をクリックして、ファイル エクスプローラーで [名前を付けて保存] ダイアログを開くように指定したことになります。 Acrobat Reader のファイルを開いたウィンドウで、[名前を付けて保存] ダイアログの [別のフォルダーを選択...] をクリックします。

    15. StudioX のリボンの [プロジェクト] > [プロジェクト フォルダー開く] を選択し、ファイル エクスプローラーでプロジェクト フォルダーを開いて、フォルダーへのフル パスをアドレス (場所) バーからコピーします。

    16. In StudioX, click Add Activity ドキュメントの画像 below the Click activity inside For Each Excel Row, and then find the Use Application/Browser activity in the search box at the top of the screen and select it. The activity is added to the Designer panel.

    17. [アプリケーション/ブラウザーを使用] アクティビティ内で [アプリケーションを指定] をクリックして、マウス ポインターを Acrobat の [名前を付けて保存] ダイアログに移動します。ウィンドウが青く強調表示されたら、ウィンドウ内の任意の場所をクリックします。

      [アプリケーション/ブラウザーを使用] アクティビティが更新され、ウィンドウのスクリーンショットがアクティビティに表示されます。また、実行可能ファイルのパスが [アプリケーション パス] フィールドに表示されます。

    18. Click Add Activity ドキュメントの画像 inside the newly added Use Application/Browser, and then find the Type Into activity in the search box at the top of the screen and select it. The activity is added to the Designer panel.

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

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

      • Click Plus docs image on the right side of the Type this field, and then select Text.

        テキスト ビルダーで

        1. 手順 16 でコピーしたパスを貼り付けます。

        2. \EquipmentAgreements\EquipmentAgreement_ と入力します。

        3. Click Plus ドキュメントの画像 on the right side, and then select Employee > First Name.

        4. Click Plus ドキュメントの画像 on the right side, and then select Employee > Last Name.

        5. Click Plus ドキュメントの画像 on the right side, and then select Special Keys > Enter.

        6. [保存] をクリックします。

          テキストは次の画像のようになります。

          ここでは、従業員の名前を含むファイル名を使用して EquipmentAgreements フォルダーに各 PDF ファイルを保存するように指定しました。

          [繰り返し (Excel の各行)] アクティビティは、次の画像のようになります (より大きな画像を表示するには、画像を右クリックして保存してください)。

19. Click Save in the StudioX ribbon to save the automation. 20. To avoid any issues during execution, make sure no PDF files are open in Adobe Acrobat. and then click Run to execute the automation.The values are copied from the Excel file to the PDF form for each employee and each PDF is saved with the employee name in the newly created folder. Download example

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

接続

ヘルプ リソース サポート

学習する UiPath アカデミー

質問する UiPath フォーラム

最新情報を取得