activities
latest
false
UiPath logo, featuring letters U and I in white
Productivity Activities
Last updated Nov 21, 2024

Read, Write, and Append Data in Excel

The example below explains how to copy ranges from a workbook, paste, and append them to another workbook. It presents activities such as Read Range Workbook, Write Range Workbook, and Append Range Workbook. You can find these activities in the UiPath.Excel.Activities package.

Note: Download and extract the archive with the project in this example and copy the two .xlsx files to your project folder.

This is how the automation process can be built:

  1. Open Studio and create a new Process.
  2. Drag a Sequence container in the Workflow Designer.

    • Create the following variable:

      Variable Name

      Variable Type

      Default Value

      employees

      DataTable

      N/A
  3. Add a Read Range activity inside the Sequence container.

    • Add the expression "companyEmployees.xlsx" in the Workbook path field.
    • Add the value QADep in the Sheet field and set the cells range at "A1:B5".
  4. Add a Write Range activity below the Read Range activity.

    • Add the expression "employeeIncome.xlsx" in the Workbook path field.
    • Add the value "DecemberIncome" in the Sheet field and set the cells range at "A2".
    • Add the variable employees in the Data Table field.
  5. Add a Read Range activity below the Write Range activity.

    • Add the expression "companyEmployees.xlsx" in the Workbook path field.
    • Add the value DevDep in the Sheet field and set the cells range at "A6:B10".
  6. Add an Append Range activity below the Read Range activity.

    • Add the expression "employeeIncome.xlsx" in the Workbook path field.
    • Add the value "DecemberIncome" in the Sheet field.
    • Add the variable employees in the Data Table field.

This is how the workflow should look:



7. Run the process. The activities copy data from one workbook and add it into a second workbook.

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.