How do I update same DataTable in foreach parallel

Hi team,

I am able to do it fine using foreach, but I want to know what is the thread-safe practice to do this. I have plenty of records to be updated, and bot is taking like 30minutes to complete execution due to sheet volume of data, hence I want to use foreach parallel to bring in speed.

Thanks and regards,

Hi Saikumar,

“For Each Parallel” Activity can be used in scenarios where some independent activities need to be performed in parallel with the same number of iterations. Updating data in a single excel is not a suitable scenario for this activity.

Some alternate approaches:

  1. Divide the main Excel to small excel files and perform the update in parallel. (Use Parallel activity for asynchronous processing)
  2. Move the data to queue and use multiple robots to process the data simultaneously.


1 Like

Thank you Tuhin for your reply.
I am actually working just with a dataTable and not an excel.

With regards to your approaches
Option1- this may not be possible because this has to be dynamically done by the bot based on the filtering criteria on the datatable. Suppose say run certain operations for each customer in the dataTable where multiple rows of a customer exist.

Option2- this would pose same challenge as above, as I wont be able to partition data before moving to queue.

Just thinking what could be more better approach.