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

StudioX ユーザー ガイド

最終更新日時 2025年6月4日

チュートリアル: Web ページから表データを抽出し、Excel で編集する

このチュートリアルでは、ユーロ圏以外の国に対する本日のユーロの為替レートを収めた表を、欧州中央銀行の Web サイトから抽出するオートメーション プロジェクトを作成します。為替レートの履歴データが Excel スプレッドシートに保持されており、このデータを毎日追加していきます。Web サイトから抽出するデータの形式が Excel スプレッドシートの形式と異なっているので、抽出後のデータを Excel で編集し、適切な形式を適用する必要もあります。

プロジェクトを作成したら、まずは使用する Excel ファイルを指定する [Excel ファイルを使用] アクティビティを追加します。次に、StudioX のリボンの [データ抽出] をクリックし、Web サイトからデータを抽出するウィザードを開始します。このウィザードを完了すると、2 つの設定済みアクティビティとして、Web ページを指定する [アプリケーション/ブラウザーを使用] アクティビティおよびデータを抽出する [表データを抽出] アクティビティが自動的にプロジェクトに追加されます。次に、データを入れ替え、日付または数値としてデータを書式設定し、為替レートの履歴を収めたワークシートにそのデータを追加する一連の Excel アクティビティを追加します。

  1. プロジェクトを設定し、必要なファイルを取得します。
    1. 既定の設定を使用して新しい空のプロジェクトを作成します
    2. このページ下部にあるボタンを使用して、オートメーション プロジェクトを収めたアーカイブをダウンロードして展開し、currency data.xlsx ファイルをプロジェクト フォルダーにコピーします。
    3. この例では Google Chrome を使用します。Google Chrome を使用するには、UiPath® Chrome 拡張機能をインストールする必要があります。インストールするには、[ホーム] (StudioX の Backstage ビュー) > [ツール] に行き、[UiPath 拡張機能] の一覧にある [Chrome] をクリックします。
  2. Excel ファイルをプロジェクトに追加します。
    1. Click Add Activitydocs image 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 currency data.xlsx
      • [参照名] フィールドに「currency」と入力します。

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

  3. Web ページからデータを抽出します。
    1. Google Chrome を開き、Web ページ https://www.ecb.europa.eu/stats/policy_and_exchange_rates/euro_reference_exchange_rates/html/index.en.html に移動します。
    2. StudioX で、リボンの [表抽出] をクリックして抽出ウィザードを開きます。
    3. [抽出するデータを選択] をクリックして、データの抽出元のテーブルを指定します。
    4. マウス カーソルを移動して、StudioX で検出されたユーザー インターフェイス要素が強調表示される様子を確認します。テーブルの任意の場所にマウス カーソルを移動し、クリックします。たとえば、[Currency] という見出しをクリックします。
    5. StudioX は、表がクリックされたことを検出し、表全体からデータを抽出するかどうかを尋ねます。[はい] をクリックします。
    6. [プレビュー] ボタンをクリックすると、抽出される表データのプレビューを表示できます。
    7. データが複数ページにわたる場合は、[複数ページからデータを抽出] を選択できます。この例では、データが複数のページにわたっていないので、[いいえ] を選択します。

      ウィザードが終了します。[アプリケーション/ブラウザーを使用] および [表データを抽出] アクティビティが追加されたプロジェクトが StudioX に表示されます。

    8. In the Extract Table Data activity, click Plusdocs image on the right side of the Extract to field, and then select currency > Sheet1 [Sheet] to indicate that you want to copy the extracted data to Sheet1 of the currency Excel file.
  4. データに対して行/列の入れ換えと書式設定を行い、Historical Data シートにコピーします。
    1. Click Add Activitydocs image below the Use Application/Browser activity, then find the Copy Range activity in the search box at the top of the screen and click it. The activity is added to the project.
    2. [範囲をコピー] アクティビティで、次の操作を行います。
      • Click Plus on the right side of the Source field, and then select currency > Indicate in Excel.
      • Excel ファイルの Sheet1 を選択し、範囲 A2:C33 (Web ページから抽出したデータの見出し行を除いた部分の範囲) を選択します。つづいて Excel のリボンの [UiPath] タブで [Confirm (確定)] をクリックします。

        これで、currency ファイルの Sheet1 の範囲 A2:C33 をコピーするように指定したことになります。

      • Click Plus on the right side of the Destination field, and then select currency > Indicate in Excel.
      • Excel ファイルの Sheet2 を選択し、セル B1 を選択します。つづいて、Excel のリボンの [UiPath] タブで [Confirm (確定)] をクリックします。

        これで、currency ファイルの Sheet2 のセル B1 から始まる領域にデータを貼り付けるように指定したことになります。

      • [コピーする内容] ドロップダウン メニューの [すべて] を選択します。
      • [行/列の入れ替え] を選択して、貼り付け先でデータの行と列を入れ替えるように指定します (列を行に、行を列にして貼り付け)。
    3. Click Add Activitydocs image below the Copy Range activity, then find the Format Cells activity in the search box at the top of the screen and click it. The activity is added to the project.
    4. [セルを書式設定] アクティビティで、次の操作を行います。
      • Click Plus on the right side of the Source field, and then select currency > Indicate in Excel.
      • Excel ファイルの Sheet2 を選択し、為替レートが入力された 3 行目全体を選択します。Excel のリボンの [UiPath] タブで [Confirm (確定)] をクリックします。
      • [書式設定] をクリックします。[データの種類] タブを選択し、[分類] ドロップダウン メニューから [数値] を選択します。[小数点以下] ボックスに「2」と入力して、[桁区切り ( , ) を使用] を選択します。

        これにより、Sheet2 の行 3 のデータを、桁区切りを使用した小数点以下 2 桁の数値として書式設定するように指定したことになります。

    5. 前のアクティビティの下に、2 番目の [セルを書式設定] アクティビティを追加します。
    6. 2 番目の [セルを書式設定] アクティビティで、次の操作を行います。
      • Click Plus on the right side of the Source field, and then select currency > Indicate in Excel.
      • Excel ファイルの Sheet2 を選択し、セル A3 を選択します。つづいて、Excel のリボンの [UiPath] タブで [Confirm (確定)] をクリックします。
      • [書式設定] をクリックします。[データの種類] タブを選択し、[分類] ドロップダウン メニューから [日付] を、[日付形式] ドロップダウン メニューから [3/14/2012] を選択します。

        これにより、Sheet2 のセル A3 のデータを、d/mm/yyyy の日付形式として書式設定するように指定したことになります。これは、今日の日付を追加するセルです。

    7. Click Add Activitydocs image below the second Format Cells activity, then find the Write Cell activity in the search box at the top of the screen and click it. The activity is added to the project.
    8. [セルに書き込み] アクティビティで、以下の手順を実行します。
      • Click Plus on the right side of the What to write field, and then select Project Notebook (Notes) > Date [Sheet] > Today [Cell].
      • Click Plus on the right side of the Where to write field, and then select currency > Indicate in Excel.
      • Excel ファイルの Sheet2 を選択し、セル A3 を選択します。つづいて、Excel のリボンの [UiPath] タブで [Confirm (確定)] をクリックします。

        これで、currency ファイルの Sheet2 のセル A3 にプロジェクト ノートブックから今日の日付をコピーするように指定したことになります。

    9. Click Add Activitydocs image below the Write Cell activity, then find the Append Range activity in the search box at the top of the screen and click it. The activity is added to the project.
    10. [範囲を追加] アクティビティで、以下の手順を実行します。
      • Click Plus on the right side of the Excel range to append field, and then select currency > Indicate in Excel.

        * Excel ファイルの Sheet2 を選択し、3 行目全体を選択します。Excel のリボンの [UiPath] タブで [確認] をクリックします。

        これで、Sheet2 の行 3 のデータをコピーし、currency ファイルの Historical Data シートの既存データの後に追加するように指定したことになります。

        * Click Plus on the right side of the Append after range field, and then select currency > Historical Data [Sheet]. * From the What to copy drop-down menu, select All. * Leave Transpose deselected, since we don't need to transpose the data.

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

    Web ページが開き、為替レートが Excel にコピーされます。Excel では、為替レートに書式が設定され、Historical Data シートに追加されます。

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

サポートを受ける
RPA について学ぶ - オートメーション コース
UiPath コミュニティ フォーラム
Uipath Logo White