For Each Row in Data Table: Collection was modified; enumeration operation might not execute. Trying to delete rows in excel

Hi all,

Used add data row in for each loop,
image
getting this error.
image
What changes needs to be done, please guide me on this…

@lakshmi.mp

in the write range change the Range as “A1” with “”

cheers

@Shiva_Nikhil same error getting…

Hi @lakshmi.mp ,

I believe you are adding the rows to the same Datatable that you are iterating in For Each Row Activity .

You could use an Output Datatable which has the Schema of the Iterative Datatable and use it for adding rows. This can be done using Clone().

OutputDT = InputDT.Clone
1 Like

@lakshmi.mp

can you share the entire image of the code from for each row in datatable activity

or can you share the code

cheers

@supermanPunch , @Shiva_Nikhil
image
Only one row its writing
image => input
Input having 400 rows of data
image

Why it’s writing only one row?
Performed the filter operation trying to write the filtered data to excel but not able to write.
Tried with write cell only one filtered column writing to excel not writing the other columns. other columns are also required.
Please help me on this…

@lakshmi.mp

Change the range of writerange workbook activity to “”

Check whether you are getting all the rows are not before to write range workbook activity

cheers

@Shiva_Nikhil ,
Sample excel file and workflow has been attached.
Please look into it.
End date filter.xaml (22.9 KB)
Test123.xlsx (10.3 KB)

@Shiva_Nikhil ,
Only one row of add writing to sheet3
image

@lakshmi.mp ,

You would require to keep the Assign activity out of and before the For Each Row Activity.

@lakshmi.mp

I have modified some changes please try this

End date filter.xaml (22.9 KB)

1 Like

@lakshmi.mp

End date filter (2).xaml (23.2 KB)

check this i have made small change

cheers

1 Like

@lrtetala , @Shiva_Nikhil , @supermanPunch Thanks a lot for helping me…

2 Likes

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