Hi everyone, the problem is (to make a long story short) that I have an Excel table to loop through - and when some row meets a certain condition, two empty rows are to be added above and one below, what increases the scope to loop through. I can’t tell how many rows are going to be added in advance. For each row in Data Table activity doesn’t help as it predefines a set number of rows that cannot be increased in the process, and the loop stops at the row number that was initially the last one in the scope, ignoring the number of rows that was added altogether within the process. I know how to do it with a script, but how to build it with UiPath activities? Thank you in advance for your help.
Can you explain in steps what you need like what will be your input and expected output file
Let’s say I have initially 7 rows to iterate through (up to the row 8). But if in some row the formula in column B spits out “yes”, then during my loop I add two empty rows above that row and one empty row below, thus increasing the scope to loop through - in this particular case, it will reach eventually up to the row 14 (of course, I don’t know in advance how many rows will be added during the loop). I don’t want this automation to stop on the initially last row 8, but to carry on until the last row of the increased scope (14). I hope it makes sense.
TestData.xlsx (10.6 KB)
Thank you.


Main.xaml (17.4 KB)
Greetings @PAD,
Attached is the workflow. Have done a happy flow path. Let me know if it works for you and your requirement is captured…
Step 1 : Filter Datatable to get the number of rows with “Yes” condition.
Step 2 : Iterate through the filter datatable and add required empty rows.
Step 3: Send the control back to initial and re-read datatable with “Yes” condition and subsequent empty rows and add empty rows.
Thanks,
Shabbir