UiPath Documentation
studiox
2024.10
true

StudioX user guide

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

チュートリアル: ピボット テーブルを作成する

このチュートリアルでは、サプライヤーに関するデータが入力された Excel ファイルを使用します。この Excel ファイルに各市区町村にサプライヤーが何社存在し、それらのサプライヤーが各市区町村に何名の従業員を抱えているかを調べます。このタスクを実現するために、ピボット テーブルを作成するオートメーションを構築します。

  1. プロジェクトを設定し、必要なファイルを取得します。
    1. Create a new blank project using the default settings.
    2. このページの一番下にあるボタンをクリックして、このチュートリアルで使用するオートメーション プロジェクトを収めたアーカイブをダウンロードします。そのアーカイブを展開して、ファイル Suppliers.xlsx を自分のプロジェクト フォルダーにコピーします。
  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 Suppliers.xlsx

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

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

  3. [ピボット テーブルを作成] アクティビティを追加して設定する
    1. In the Use Excel File activity, click Add Activity ドキュメントの画像, then find the Create Pivot Table activity in the search box at the top of the screen and double-click it. The activity is added inside the Use Excel File activity.

    2. [ピボット テーブルを作成] アクティビティで、以下の手順に従い、参照元とする範囲とピボット テーブルを作成する範囲を定義します。

      a) Click Plus docs image on the right side of the Source field, and then select Suppliers > Indicate in Excel.

      b) Excel ファイルで Input シートのすべての列を選択します。Excel のリボンの [UiPath] タブで [確定 (Confirm)] をクリックします。

      これで、参照名が Suppliers である Excel ファイルの Input シートにある列 A ~ L からピボット テーブルを作成するように指定したことになります。[表の範囲] フィールドには、選択した範囲として [Suppliers] Input!A:L が表示されます。

      c) Click Plus ドキュメントの画像 on the right side of the New table name field and then select Text. In the Text Builder window, enter a name for the pivot table, for example CountByCity and click Save.

      d) Click Plus docs image on the right side of the Destination field and then select Suppliers > Output [Sheet].

      これで、参照名が Suppliers である Excel ファイルの Output シートにピボット テーブルを作成するように指定したことになります。[ターゲット] フィールドには、選択したシート [Suppliers] Output が表示されます。

    3. [ピボット テーブルを作成] アクティビティで、ピボット テーブルのフィールドを追加します。

      a) Click the Add Pivot Table Field button, then click Plus docs image on the right side of Field and select Range > City.

      b) [ピボット テーブルの種類] ドロップダウン メニューで [行] を選択します。

      これで、参照名が Suppliers である Excel ファイルの Input シートにある列 City に入力された項目を、ピボット テーブルの行にするように指定したことになります。

      c) [ピボット テーブル フィールドを追加] ボタンを再度クリックして、サプライヤーの数をカウントする 2 番目のフィールドをピボット テーブルに追加します。

      In the second Pivot Field, click Plus docs image on the right side of Field and then select Range > Internal Name.

      d) [ピボット テーブルの種類] ドロップダウン メニューから [Value]、つづいて [関数] ドロップダウン メニューから [Count] をそれぞれ選択します。

      これで、参照名が Suppliers である Excel ファイルの Input シートにある列 Internal Name で特定したサプライヤーをカウントするように指定したことになります。

      e) [ピボット テーブル フィールドを追加] を再度クリックして、従業員数を合計する 3 番目のフィールドをピボット テーブルに追加します。

      In the third Pivot Field, click Plus docs image on the right side of Field and then select Range > Number of Employees.

      f) [ピボット テーブルの種類] ドロップダウン メニューから [Value]、つづいて [関数] ドロップダウン メニューから [Sum] をそれぞれ選択します。

      これで、参照名が Suppliers である Excel ファイルの Input シートにある従業員数を合計するように指定したことになります。

      g) ピボット フィールドをより簡単に識別するには、各フィールドの上部のバーで名前を編集します。たとえば、最初のフィールドには Pivot Field City、2 番目のフィールドには Pivot Field Name、3 番目のフィールドには Pivot Field Employees を使用します。

      ドキュメントの画像

    4. Click Save in the StudioX ribbon to save the automation, then click Run to execute the automation.The pivot table is created in the Output sheet of the Suppliers.xlsx file. Download example

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

接続

ヘルプ リソース サポート

学習する UiPath アカデミー

質問する UiPath フォーラム

最新情報を取得