Insert one row at multiple indices

Hi Team,

I am looking insert a row at mutiple indices, Below is the example.

I need to insert row after 12, 24, 36, 48,…rows in excel. I have tried using ‘for’ loop but its not getting through, so need a help here.

Hi @kallapari.pavansudheendra ,

Could you let us know what was not working and the implemented approach ?

We can check with InsertAt method available with Datatable.Rows

So using a For Each activity to loop through the indices array and using Invoke Method activity to add the Empty rows like shown below :
image

Parameter Config :

Let us know if this does not work.

Hi,

Thanks for reply. I am developing in studioX, not Studio. So unable to find the same tool (the one you have used) in studioX.

Hi @kallapari.pavansudheendra

Try this:

  1. Use “For Each” activity, set the “Type Argument” to Int32.
  2. For the “Values” property, provide the list of row indices where you want to insert rows (e.g., {12, 24, 36, 48, …}).
  3. Use the “Excel Insert Rows” activity
  • Set the “Sheet Name” property to the name of the sheet where you want to insert the rows.
  • Set the “Insert Position” property to currentValue.
  • Set the “Number of Rows” property to the number of rows you want to insert at each index (in this case, 1 row).

Thank you, this worked

1 Like

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.