UiPath Documentation
studiox
2023.10
false
重要 :
このコンテンツの一部は機械翻訳によって処理されており、完全な翻訳を保証するものではありません。 新しいコンテンツの翻訳は、およそ 1 ~ 2 週間で公開されます。
UiPath logo, featuring letters U and I in white

StudioX user guide

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

チュートリアル: フォルダー内のファイルに関する情報を Excel ファイルに追加する

このチュートリアルでは、あるフォルダー内のすべてのファイルの名前とサイズを取得し、その情報を Excel ファイルに追加するオートメーションを作成します。

We will create a project and start by adding a Use Excel File activity to indicate the Excel file to use. We will then add a For Each File In Folder activity to indicate the folder from which to retrieve file information. Inside For Each File in Folder, we will add two Write Cell activities, one to copy the name, the other to copy the size of each file to two cells in the Project Notebook. We will finish by adding an Append Range activity that appends the two cells to a range in an Excel file after the cells are populated for each file.

  1. プロジェクトを設定し、プロジェクト フォルダーに Excel ファイルを作成する
    1. Create a new blank project using the default settings.
    2. プロジェクト フォルダー内に Excel ファイルを作成し、files.xlsx という名前を付けます。
    3. 新規に作成したファイルを Excel で開き、セル A1 にテキスト File Name、セル B1 にテキスト File Size を入力します。
    4. files.xlsx を保存して閉じます。
  2. プロジェクトにこの Excel ファイルを追加して、反復処理するファイルを含むフォルダーを指定する
    1. StudioX の [アクティビティ] パネルで [Excel] タブを選択し、[Excel ファイルを使用] をダブルクリックします。[Excel ファイルを使用] アクティビティがデザイナー パネルに追加されます。

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

      • Click Browse ドキュメントの画像 next to the Excel file field, and then browse to and select the file files.xlsx.
      • [参照名] フィールドに「NamesSizes」と入力します。
    3. [アクティビティ] パネルで [ファイル] タブを選択し、[繰り返し (フォルダー内の各ファイル)] アクティビティをドラッグして [Excel ファイルを使用] アクティビティ内にドロップします。

    4. 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.

      ドキュメントの画像

  3. Excel ファイルにファイル情報をコピーする
    1. [アクティビティ] パネルで [Excel] タブを選択し、[セルに書き込み] アクティビティをドラッグして [繰り返し (フォルダー内の各ファイル)] アクティビティ内にドロップします。

    2. [セルに書き込み] アクティビティで、以下の手順を実行します。

      • 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.
    3. 最初の [セルに書き込み] アクティビティの下に、2 番目の [セルに書き込み] アクティビティを追加します。

    4. [セルに書き込み] アクティビティで、以下の手順を実行します。

      • 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.
    5. 2 つの [セルに書き込み] アクティビティをより簡単に識別するには、各アクティビティの上部のバーで名前を編集します。たとえば、最初のアクティビティには Write Cell Name、2 番目のアクティビティには Write Cell Size を使用します。

    6. [アクティビティ] パネルで [範囲を追加] アクティビティをドラッグして、[繰り返し (フォルダー内の各ファイル)] アクティビティ内の 2 番目の [セルに書き込み] アクティビティの下にドロップします。

    7. [範囲を追加] アクティビティで、以下の手順を実行します。

      • Click Plus ドキュメントの画像 on the right side of the Append after range field and then select NamesSizes > Sheet1.

      • Click Plus docs image 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.

        ドキュメントの画像

    8. StudioX のリボンで [保存] をクリックしてオートメーションを保存し、[実行] をクリックしてオートメーションを実行します。

      The name and size of each file in the indicated folder are copied one by one to cells A1 and A2 in the Scratchpad sheet of the Project Notebook, and then appended to files.xlsx.Download example

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

接続

ヘルプ リソース サポート

学習する UiPath アカデミー

質問する UiPath フォーラム

最新情報を取得