studiox
2022.10
false
UiPath logo, featuring letters U and I in white
StudioX User Guide
Last updated Nov 18, 2024

Tutorial: Copying From CSV to Excel and Emailing the File

In this tutorial, we'll copy the data from a CSV file to an existing Excel file and then we'll attach the Excel file to an email and send the email from 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. Step 1: Set up the project and get the necessary files.
    1. Create a new blank project using the default settings.
    2. Download and extract the archive with the automation project in this example using the button at the bottom of this page, then copy the files A.csv and B.xlsx to your project folder.
  2. Step 2: Add the Excel file to the project.
    1. Click Add activity docs 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. In the activity:
      • Click Browse docs image next to the Excel file field, and then browse to and select the file B.xlsx
      • In the field Reference as, enter ExcelB.

        You have indicated that you will work on the file B.xlsx that is known in your automation as ExcelB.

  3. Step 3: Add an activity to copy the data from the CSV file to the Excel file.
    1. Click Add activity docs image 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. In the Read CSV activity:
      • Click Browse docs image next to the Read from file field, and then browse to and select the file A.csv.
      • Click Plus 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.

        You have indicated that you want to copy the data from the CSV file A.csv to the file ExcelB in Sheet1 starting with the A7 cell.



  4. Step 4: Add the Outlook account to the project and send the email.
    1. In the Activities panel, select the Mail tab and drag the Use Desktop Outlook App activity and drop it below the Use Excel File activity. A Use Desktop Outlook App activity is added to the Designer panel.
    2. In the activity, the default email account is already selected in the Account field. If you want to use a different account, select it from the drop-down menu.
      In the Reference as field, leave the default value Outlook as the name by which to refer to the account in the automation.
    3. In the Activities panel, drag the Send Email activity and drop it inside the Use Desktop Outlook App activity.
    4. In the Send Email activity:
      • Click Plus docs image on the right side of the From account field, and then select Outlook.
      • Click Plus docs image 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 Is draft option selected, the automation does not send the email, it instead saves the email to the Outlook Drafts folder.
      • Click Plus docs image 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 docs image 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 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.

Was this page helpful?

Get The Help You Need
Learning RPA - Automation Courses
UiPath Community Forum
Uipath Logo White
Trust and Security
© 2005-2024 UiPath. All rights reserved.