UiPath Documentation
studiox
2024.10
true

StudioX user guide

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

Excel の自動化

Excel の自動化について

StudioX offers a deep integration with Microsoft Excel and ships with a number of activities that automate the tasks you perform in Excel. For information on installing the Excel add-in, see the Studio guide.

You start by adding the Excel file you want to automate as a resource to the automation project, and then add the activities to perform in the file. When configuring the activities that use the file, you can select sheets, tables, named ranges, and named cells directly from the Plus docs image menu in StudioX. You can also seamlessly switch from StudioX to Excel to indicate the data to use directly from the file.

ドキュメントの画像

If you click Indicate in Excel in the Plus docs image menu when configuring an activity to select data directly from the file, your spreadsheet is opened in Excel and a UiPath tab appears in the Excel ribbon. Select the data you want to use, for example a cell or a range of cells, and then click Confirm in the UiPath tab to confirm the selection.

ドキュメントの画像

You can also manually indicate the Excel data to use by selecting the Custom Input option in the Plus docs image menu. This option enables you to enter cell and range references, table names, or sheet names, which can be useful when you are working with Excel files with dynamic names, or with files that don't exist at design time and no template file is available.

ドキュメントの画像

If you want to repeat the same activities for each row in a range, add a For Each Excel Row activity, and then add the activities to repeat inside it.

Excel タスクを自動化する方法については、以下のチュートリアルをご覧ください。

StudioX では以下のアクティビティが利用可能です。

注:

There are a couple of different ways of launching and previewing Excel files, both at runtime and at design time. To learn more, see the Project settings.

Excel ファイルをオートメーションに追加する

オートメーションへのファイルの追加方法によって、プロジェクト内のどのアクティビティが Excel ファイルにアクセスして変更できるかと、実行中にファイルが開かれたままになる時間が決まります。オートメーションに Excel ファイルを追加する方法は 2 つあります。

  • Add a Use Excel File resource activity. Using this option, the data in the file can only be accessed by the activities added inside the resource activity. After all the activities inside Use Excel File are executed, the file is closed. This is useful when the file will be created at runtime (e.g. downloaded or saved from an email attachment) or if the file needs to sent to another location (e.g. uploaded or sent as an email attachment).
  • Connect the project to the Excel file from the Data Manager to add it as a project resource. Using this option, you can configure the scope where the file is available and set it to either the entire workflow or only to a certain container activity. By default, the scope is set to the main container (the entire project), which means that it can be accessed and modified by all the activities in the project, and the file remains open until the entire project is executed. If you don't need the Excel resource to be available in the entire project, you can set the scope closer to the activities where it is used. This ensures the file is open only when it's needed, which can speed up execution. For example, you can add all the activities that interact with an Excel file inside a Group container activity and set the scope to the Group container. Connecting the project to an Excel file is useful when the file name and location won't change and the file doesn't need to be used for other purposes such as uploading or sending as an email attachment.

プロジェクト ノートブックについて

プロジェクト ノートブックは、式を保存したりデータを操作したりするメモ帳として使用できる Excel のブックです。その目的は、プロジェクトの実行時に計算や一時データの保存に使用することです。既定では、オートメーションの実行が完了しても、プロジェクト ノートブックに加えた変更は保存されません。

The default Project Notebook is a file named Project_Notebook.xlsx that is created by StudioX in the project folder. The file comes with a predefined set of formulas that you can use in any automation project. The formulas are split on several sheets based on the area they apply to. Each sheet contains cells where you can add input data and formulas that manipulate that data. The formulas are in easy to identify named cells that you can select for use in your automations directly from the Plus docs image menu.

プロジェクト ノートブックを構成する

StudioX のリボンから [ノートブック] > [ノートブックを設定] を選択します。以下を設定できます。

  • ノートブック ファイル - プロジェクト ノートブックとして使用する、別の Excel ファイルを選択します。

  • 後で使用するための名前 - アクティビティで Excel ファイルを操作するときに、プロジェクトでそのファイルを参照するための名前を入力します。既定の名前は Notes です。

  • アクセス パスワード - ファイルを開くときにパスワードが要求されるようにする場合、そのパスワードを入力します。

  • 編集用パスワード - ファイルを編集するときにパスワードが要求されるようにする場合、そのパスワードを入力します。

  • Autosave file - Select this option if you want the file to be saved at the end of the automation. Otherwise, the file is returned to the initial state after project execution. This option is not selected by default. When the option to save changes is disabled, the message Save changes: off is displayed next to the Project Notebook entries in the Plus docs image menu and in the Data Manager panel.

    ドキュメントの画像

  • 読み取り専用 - ファイルを読み取り専用モードで開くようにするには、このオプションを選択します。これにより、ファイルの編集がロックされている場合や、編集パスワードが設定されている場合でも、データの抽出操作を実行できます。このオプションは既定で選択されていません。

プロジェクト ノートブックの式

The formulas available in the Project Notebook are detailed below. To learn how you can add formulas to the Project Notebook, see Tutorial: Adding Your Own Formulas to the Project Notebook.

日付

セル B4 (日付) に基準日 (既定は今日の日付)、セル B6 (日数) に日数 (既定は 7) を入力します。この値が、後でシート内のセル B4 の日付に加算されます。次の式を使用できます。

  • 日数が追加された後の日付 - セル B4 に入力した日付に、セル B6 の日数を加算して得られる日付を返します。
  • 稼働日数が追加された後の日付 - セル B4 に入力した日付に、セル B6 の日数 (週末は除く) を加算して得られる日付を返します。
  • 日付形式 (YYYYMMDD) - セル B4 に入力した日付を、YYYYMMDD 形式のテキストに変換して返します。
  • 今日の日付 - 今日の日付を返します。
  • 先週の日付 (月曜日、金曜日、日曜日) - 先週の月曜 (LastWeekMonday)、金曜 (LastWeekFriday)、日曜の日付 (LastWeekSunday) を返します。
  • 先月の日付 (1 日目と最終日) - 先月の最初の日付 (LastMonthStartDate) と最後の日付 (LastMonthEndDate) を返します。
  • 今月の最初の営業日/最終稼働日 - 今月の最初の営業日の日付 (ThisMonthFirstWorkingDay) と最終営業日の日付 (ThisMonthLastWorkingDay) を返します。
ロケールに依存しない方法でテキストを日付に変換する

日本語の年、月、日を表す文字を数値の後ろに挿入した日付をセル B18 (テキスト) に入力します。この日付が、MM/DD/YYYY 形式に変換され、セル B29 (再設定された日付) に返されます。

For an example of how you can use the formulas in the Date sheet, see Tutorial: Working with Files and Folders.

テキスト

セル B4 (テキスト) にテキストを入力します。セル B4 内で特定のテキストを検索するには、セル B10 (検索する文字列) に検索するテキストを入力します。検索したテキストを別のテキストに置換するには、置換するテキストをセル B11 (置換後の文字列) に入力します。次の式を使用できます。

  • トリム - セル B4 のテキストから余分な空白文字を削除して返します。
  • 長さ - セル B4 のテキストの文字数を返します。
  • 大文字 - セル B4 のテキストを、すべて大文字に変換して返します。
  • 小文字 - セル B4 のテキストを、すべて小文字に変換して返します。
  • 置換結果 - セル B4 のテキストに対して、セル B10 に追加されたテキストを、セル B11 に追加されたテキストで置換した結果を返します。
  • 検索結果 - セル B10 に追加されたテキストが、セル B4 のテキストに含まれるかどうかをチェックします。テキストが見つかった場合は TRUE、見つからなかった場合は FALSE を返します。
  • - セル B4 のテキストの最後の空白文字の前のテキストを返します。
  • - セル B4 のテキストの最後の空白文字の後のテキストを返します。
テキストから値を抽出する

セル B4 に追加されたテキストから特定の値をセル F5 に抽出するには、値の左側のテキストをセル D5 に入力するか、値の右側のテキストをセル E5 に入力します (または、両方に入力)。複数の値を抽出するには、行 6 から 9 で同じ列のセルを使用します。これをオートメーションで使用すれば、同じテンプレートに従うテキストの塊の中から可変の部分を抽出できます。たとえば、同じラベルが先頭に付けられた、自動化されたメール通知から請求書の番号や金額などの値を抽出できます。

For an example of how you can use the formulas in the Text sheet, see Tutorial: Extracting Data from Automated Emails and Moving It to a Desktop Application.

Number

セル B4 (数字) に数値を入力します。この数値を操作する、次の式を使用できます。

  • クリーンアップ済み - B4 に追加された数値から、改行とノーブレーク スペース (改行しない空白文字) をすべて削除して返します。
  • 整数 - セル B4 の整数部分を返します。
  • 小数第 2 位 - セル B4 に追加された値を小数点以下 2 桁にして返します。
ロケールに依存しない方法でテキストを数字に変換する

桁区切り文字がないか、桁区切り文字としてピリオド (.) を使用していて、かつ小数桁の区切り文字としてコンマ (,) を使用している数値をセル B11 (テキスト) に入力します。この数値が、桁区切り文字としてコンマ (,)、小数桁の区切り文字としてピリオド (.) を使用した値に変換されて、セル B15 (再設定された数字) に返されます。

ファイル

ファイルへのフル パスを拡張子まで含めてセル B6 (ファイル パス) に入力します。次の式を使用できます。

  • ファイル名 - セル B6 に追加されたファイル パスから、拡張子を含むファイル名を返します。
  • ファイル拡張子 - セル B6 に追加されたファイル パスからファイルの拡張子を返します。
  • 拡張子なしのファイル名 - セル B6 に追加されたファイル パスから拡張子を除いたファイル名を返します。
  • フォルダー - セル B6 にパスを追加されたファイルを含むフォルダーへのパスを返します。
  • 再設定されたファイル名 - セル B9 と B10 の値を '.' (ピリオド) で区切って返します。結果は、拡張子付きのファイル名になります。

For an example of how you can use the formulas in the File sheet, see Tutorial: Saving, Renaming, and Moving Attachments.

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

接続

ヘルプ リソース サポート

学習する UiPath アカデミー

質問する UiPath フォーラム

最新情報を取得