- 基本情報
- チュートリアル
- オートメーション プロジェクト
- オートメーションの作成
- トラブルシューティング
StudioX user guide
このチュートリアルでは、サプライヤーに関するデータが入力された Excel ファイルを使用します。この Excel ファイルに各市区町村にサプライヤーが何社存在し、それらのサプライヤーが各市区町村に何名の従業員を抱えているかを調べます。このタスクを実現するために、ピボット テーブルを作成するオートメーションを構築します。
- プロジェクトを設定し、必要なファイルを取得します。
- Create a new blank project using the default settings.
- このページの一番下にあるボタンをクリックして、このチュートリアルで使用するオートメーション プロジェクトを収めたアーカイブをダウンロードします。そのアーカイブを展開して、ファイル
Suppliers.xlsxを自分のプロジェクト フォルダーにコピーします。
- Excel ファイルをプロジェクトに追加します。
- 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. - アクティビティで次の操作を行います。
-
Click Browse
next to the Excel file field, and then browse to and select the file Suppliers.xlsx -
[参照名] フィールドに「
Suppliers」と入力します。これで、このオートメーションでは名前を
SuppliersとしたファイルSuppliers.xlsxを操作対象として指定したことになります。
-
- Click Add Activity
- [ピボット テーブルを作成] アクティビティを追加して設定する
-
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. -
[ピボット テーブルを作成] アクティビティで、以下の手順に従い、参照元とする範囲とピボット テーブルを作成する範囲を定義します。
a) Click Plus
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 CountByCityand click Save.d) Click Plus
on the right side of the Destination field and then select Suppliers > Output [Sheet].これで、参照名が Suppliers である Excel ファイルの Output シートにピボット テーブルを作成するように指定したことになります。[ターゲット] フィールドには、選択したシート [Suppliers] Output が表示されます。
-
[ピボット テーブルを作成] アクティビティで、ピボット テーブルのフィールドを追加します。
a) Click the Add Pivot Table Field button, then click Plus
on the right side of Field and select Range > City.b) [ピボット テーブルの種類] ドロップダウン メニューで [行] を選択します。
これで、参照名が Suppliers である Excel ファイルの Input シートにある列 City に入力された項目を、ピボット テーブルの行にするように指定したことになります。
c) [ピボット テーブル フィールドを追加] ボタンを再度クリックして、サプライヤーの数をカウントする 2 番目のフィールドをピボット テーブルに追加します。
In the second Pivot Field, click Plus
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
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を使用します。
-
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
-