data-service
2023.4
false
  • Getting started
    • Introduction
    • The User Interface
    • Data Service Configuration Checklist
    • Installing Automation Suite
  • Setup and configuration
  • Using Data Service
  • Reference
    • Data Service Studio Activities
    • API Access
  • Examples & Tutorials
    • Using Entities in Projects
    • Uploading File Fields in Entity Records
    • Downloading File Fields in Entity Records
    • Uploading Data From CSV Using Batch Activities
Data Service User Guide
Automation CloudAutomation Cloud Public SectorAutomation Suite
Last updated Apr 19, 2024

Uploading Data From CSV Using Batch Activities

Tutorial Overview

Batch activities accept and return a List<T> of entity records as input and output for creating, updating, or deleting multiple items.

These activities can accept up to 1,000 records in a single call and each activity call will count as one call against your service usage quota.

To understand how to use batch activities in Data Service, download the example below and follow the steps in this tutorial. The example creates 50 records for an entity via 2 batch activity calls.

To run the downloaded example:

  • Connect to your UiPath organization.
  • Make sure Data Service is enabled in your tenant.
  • Create the entity from the example.
  • Connect the corresponding Orchestrator tenant to the UiPath® Robot.
Workflows containing batch activities typically include a For Each loop to iterate thought the records list, and to populate the List<T> list variable. The variable is then passed to the batch activity as input.

Collecting Data

The States.csv file contains the records that the batch activity adds to your Data Service entity.

To run the batch activity, create an entity that has the same fields as your data.



Creating the Entity

  1. Go to the Data Service instance of your tenant.
  2. Create New Entity called US States with the following fields:


Designing the Workflow

  1. Open Studio and start a new process.
    Note: Make sure the Data Service enabled tenant is connected to the UiPath® Robot.
  2. Install the UiPath.DataService.Activities pack.
  3. Import the previously created US States entity inside your workflow in Studio.
  4. To read the data from the States.CSV file to a data table, drag and drop the Read CSV activity.
    • In the Read from file field, enter the name of the CSV file.
    • In the Output to field, set a name for the data table.
  5. Set a variable to store the batch size (i.e, how many records to alter in a call). Use the Assign activity.
    Note: The batch size is limited to 1,000 records. To alter more than 1,000 entries, set the batch size to 1,000.
  6. Set a variable to store the list of records (for example, listUSStates). Use the Assign activity and initialize the list type to New <List(Of USStates)>. This creates an empty list, ready to be populated with the data from the CSV file.


  7. To iterate through every row in the previously created data table (step 4), use the For Each Row in Data Table activity.
  8. For each row in the data table, create a new variable (i.e, currState = New USStates) and set the values for the US States entity fields (i.e, State, DateofAdmission, Population). Use the Multiple Assign activity.
  9. To add the current state to the listUSStates list, use the Append Items To Collection activity.


  10. After each addition, check if the list size has become equal to the batch size you set at step 5. Use the If activity with the condition listUSStates.Count = batchSize. The workflow continues to add records until the If Condition is met.
  11. When the list size matches the batch size, create the records using the Create Multiple Entity Records activity. In our example, this creates 25 records using a single call.
  12. Clear the collection after each batch of records, so the count for the next batch starts from zero.


  13. Outside the For Each loop, check if there are any remaining records in the collection and create them.

    This final step is important to cases where the records count isn't a multiple of the batch size. For example, if the collection contains 80 records, the If Condition at step 10 is satisfied for 25, 50, and 75 records (multiples of 25, the example batch size). The remaining 5 records are resolved by the last If Condition outside the For Each loop.



  • Tutorial Overview
  • Collecting Data
  • Creating the Entity
  • Designing the Workflow

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.