For Each Row in Datatable error: Collection was modified; enumeration operation might not execute

Hi All,
I’m reading and saving a data table from an excel file.
Column A (index 0) has full name like “Dillon Marius”.
I want just the last name and write them in different excel file but am stuck at the below per ss. Any solution?
I was thinking to loop for each and use add data row - is this a correct method?

Hi @Dillon_Marius

Input :
image

Use the below in assign activity

CurrentRow("Name") = CurrentRow("Name").ToString.Trim().Split(" ").Last

Output :

image

Regards

if you use same datatable variable in add data row it will throw the error so instead use build data table activity and create seperate variable, for your reference i will attach one sample workflow
ExlCom.zip (14.1 KB).If you find it helpful please mark as solution

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