UiPath Documentation
studiox
2023.10
false

StudioX user guide

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

チュートリアル: CSV から Excel にコピーし、ファイルをメールで送信する

このチュートリアルでは、CSV ファイルから既存の Excel ファイルにデータをコピーし、その Excel ファイルをメールに添付して Outlook からメールを送信します。

We will create a project and start by adding a Use Excel File activity to indicate the Excel file where we want to copy the data. Inside this activity, we will add a Read CSV activity to indicate the CSV file to copy from and where in the Excel file to copy to. We'll then add a Use Desktop Outlook App activity to indicate the Outlook account to use and inside it we will add a Send Email activity to send the email.

  1. プロジェクトを設定し、必要なファイルを取得します。
    1. Create a new blank project using the default settings.
    2. この例では、このページ下部にあるボタンを使用して、オートメーション プロジェクトを含むアーカイブをダウンロードして展開し、A.csv ファイルと B.xlsx ファイルをプロジェクト フォルダーにコピーします。
  2. Excel ファイルをプロジェクトに追加します。
    1. 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.
    2. アクティビティで次の操作を行います。
      • Click Browse ドキュメントの画像 next to the Excel file field, and then browse to and select the file B.xlsx

      • [参照名] フィールドに「ExcelB」と入力します。

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

  3. アクティビティを追加し、CSV ファイルのデータを Excel ファイルにコピーする
    1. Click Add Activity ドキュメントの画像 inside the Use Excel File activity, and then find the Read CSV activity in the search box at the top of the screen and select it. The activity is added inside the Use Excel File activity.
    2. [CSV を読み込み] アクティビティで、以下の手順を実行します。
      • Click Browse ドキュメントの画像 next to the Read from file field, and then browse to and select the file A.csv.

      • Click Plus docs image on the right side of the Output to field, and then select ExcelB > Indicate in Excel. The spreadsheet is opened in Excel. Because there is already data in the file and we want to keep it, select the first cell in the first empty row (cell A7), and then click Confirm. The field is updated with your selection [ExcelB] Sheet1!A7.

        これで、CSV ファイル A.csv から、ファイル ExcelB の Sheet1 セル A7 を先頭にデータをコピーするよう指定したことになります。

        ドキュメントの画像

  4. Outlook アカウントをプロジェクトに追加して、メールを送信する
    1. [アクティビティ] パネルで [メール] タブを選択し、[デスクトップ版 Outlook アプリを使用] アクティビティをドラッグして [Excel ファイルを使用] アクティビティの下にドロップします。[デスクトップ版 Outlook アプリを使用] アクティビティがデザイナー パネルに追加されます。

    2. このアクティビティの [アカウント] フィールドには、あらかじめ既定のメール アカウントが入力されています。別のアカウントを使用する場合は、ドロップダウン メニューから選択します。

      [参照名] フィールドは既定値 Outlook のままとして、オートメーションでアカウントを参照するときは、この名前を使用します。

    3. [アクティビティ] パネルで [メールを送信] アクティビティをドラッグし、[デスクトップ版 Outlook アプリを使用] アクティビティ内にドロップします。

    4. [メールを送信] アクティビティで、以下の手順を実行します。

      • Click Plus ドキュメントの画像 on the right side of the Account field, and then select Outlook.

      • Click Plus ドキュメントの画像 on the right side of the To field, and then select Text. In the Text Builder window, enter an email address where to send the email. For example, you can enter your own email address to send the email to yourself. If you leave the Save as draft option selected, the automation does not send the email, it instead saves the email to the Outlook Drafts folder.

      • Click Plus ドキュメントの画像 on the right side of the Subject field, and then select Text. In the Text Builder window, enter a subject for the email, for example Updated Excel File.

      • Click Plus ドキュメントの画像 on the right side of the Body field, and then select Text. In the Text Builder window, enter text for the body of the email, for example See attachment.

      • For Attachments, select Files, then click Browse docs image next to the field, and then browse to and select the file B.xlsx.

        ドキュメントの画像

    5. Click Save in the StudioX ribbon to save the automation, then click Run to execute the automation.The data from A.csv is copied to B.xlsx, and then attached to a mail message and sent using the details configured in the Send Email activity. Download example

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

接続

ヘルプ リソース サポート

学習する UiPath アカデミー

質問する UiPath フォーラム

最新情報を取得