Simplifying robot execution running time

Hi, I have an activity to generate report from my SQL Query. I tried to write the raw data from my database and it only took 2 minutes with total of 600.000 data. My goal is to convert the data from row to columns (Transpose) and currently my robot execution running time took 1 hour and 15 minutes to generate the transposed data. My target maximum is 45 mins (if faster it’s ok) and I don’t know to simplify my code. Anyone can help me with this? I have attach my workflow and my excel (raw data sheet and expected output sheet), if anything is unclear let me know !

Masked Workflow Fix.xaml (46.1 KB)
Transpose - Copy.xlsx (9.7 KB)

A general flow could look like following:

  • retrieve all Distinct Due Date Values
  • optional calculate min, max due date
  • prepare a new empty datatable and create dynamically the different needed duedate cols - dtTarget

process the origin datatable by grouping the data
prepare a new empty dttarget data row with the values from the group members and add it

with some arrangements we would recommend the parallel for each activity for transponation step

Grouping the data have a look here: