- 基本情報
- チュートリアル
- オートメーション プロジェクト
- オートメーションの作成
- トラブルシューティング
StudioX ユーザー ガイド
このチュートリアルでは、あるフォルダー内のすべてのファイルの名前とサイズを取得し、その情報を Excel ファイルに追加するオートメーションを作成します。
プロジェクトを作成したら、まずは使用する Excel ファイルを指定する [ Excel ファイルを使用 ] アクティビティを追加します。次に、[ 繰り返し (フォルダー内の各ファイル )] アクティビティを追加して、ファイル情報を取得するフォルダーを指定します。[繰り返し (フォルダー内の各ファイル)] 内に [ セルに書き込み ] アクティビティを 2 つ追加します。1 つは各ファイルの名前、もう 1 つは各ファイルのサイズをプロジェクト ノートブックのセルにコピーします。最後に、[ 範囲を追加 ] アクティビティを追加して、2 つのセルに各ファイルの情報が入力された後に、それらのセルが Excel ファイル内の範囲に追加されるようにします。
- プロジェクトを設定し、プロジェクト フォルダーに Excel ファイルを作成する
- 既定の設定を使用して新しい空のプロジェクトを作成します。
- プロジェクト フォルダー内に Excel ファイルを作成し、files.xlsx という名前を付けます。
- 新規に作成したファイルを Excel で開き、セル A1 にテキスト
File Name、セル B1 にテキストFile Sizeを入力します。 - files.xlsx を保存して閉じます。
- プロジェクトにこの Excel ファイルを追加して、反復処理するファイルを含むフォルダーを指定する
-
StudioX の [アクティビティ] パネルで [Excel] タブを選択し、[Excel ファイルを使用] をダブルクリックします。[Excel ファイルを使用] アクティビティがデザイナー パネルに追加されます。
-
[Excel ファイルを使用] アクティビティで次の操作を行います。
- Click Browse
next to the Excel file field, and then browse to and select the file files.xlsx. - [参照名] フィールドに「
NamesSizes」と入力します。
- Click Browse
-
[アクティビティ] パネルで [ファイル] タブを選択し、[繰り返し (フォルダー内の各ファイル)] アクティビティをドラッグして [Excel ファイルを使用] アクティビティ内にドロップします。
-
In the For Each File in Folder activity, click Browse
next to the In folder field, and then browse to and select a folder on your computer which contains files, for example the Desktop.
-
- Excel ファイルにファイル情報をコピーする
-
[アクティビティ] パネルで [Excel] タブを選択し、[セルに書き込み] アクティビティをドラッグして [繰り返し (フォルダー内の各ファイル)] アクティビティ内にドロップします。
-
[セルに書き込み] アクティビティで、以下の手順を実行します。
- Click Plus
on the right side of the What to write field, and then select CurrentFile > Name to indicate that we want to copy the name of the current file in the iteration. - Click Plus
on the right side of the Where to write field, and then select Notebook > Indicate in Excel to open the Project Notebook. In the file, select the A1 cell in the Scratchpad sheet, and click Confirm in the UiPath tab in the Excel ribbon. You have indicated that you want to paste the name of the current file in the iteration to cell A1 in the Scratchpad sheet of the Project Notebook.
- Click Plus
-
最初の [セルに書き込み] アクティビティの下に、2 番目の [セルに書き込み] アクティビティを追加します。
-
[セルに書き込み] アクティビティで、以下の手順を実行します。
- Click Plus
on the right side of the What to write field, and then select CurrentFile > Size to indicate that we want to copy the size (in bytes) of the current file in the iteration. - Click Plus
on the right side of the Where to write field, and then select Notebook > Indicate in Excel to open the Project Notebook. In the file, select the B1 cell in the Scratchpad sheet, and click Confirm in the UiPath tab in the Excel ribbon. You have indicated that you want to paste the size of the current file in the iteration to cell B1 in the Scratchpad sheet of the NamesSizes Excel file.
- Click Plus
-
2 つの [セルに書き込み] アクティビティをより簡単に識別するには、各アクティビティの上部のバーで名前を編集します。たとえば、最初のアクティビティには
Write Cell Name、2 番目のアクティビティにはWrite Cell Sizeを使用します。 -
[アクティビティ] パネルで [範囲を追加] アクティビティをドラッグして、[繰り返し (フォルダー内の各ファイル)] アクティビティ内の 2 番目の [セルに書き込み] アクティビティの下にドロップします。
-
[範囲を追加] アクティビティで、以下の手順を実行します。
-
Click Plus
on the right side of the Append after range field and then select NamesSizes > Sheet1. -
Click Plus
on the right side of the Excel range to append field, and then select Notebook > Indicate in Excel to open the file in Excel. In the file, select the A1:B1 cells and click Confirm in the UiPath tab in the Excel ribbon. You have indicated that you want to add the information about the current file in the iteration to columns A and B in the NamesSizes file after the existing data in the file.
-
-
StudioX のリボンで [保存] をクリックしてオートメーションを保存し、[実行] をクリックしてオートメーションを実行します。
指定したフォルダー内の各ファイルの名前とサイズが、プロジェクト ノートブックの Scratchpad シートのセル A1 と A2 に 1 つずつコピーされてから、files.xlsxに追加されます。サンプルをダウンロード
-