How to trim column cell values in For Each Loop

@jeevith : I still stuck in trimming the single column. Pl. help, here is the code and I have only a problem in the inner For each row loop where I want to mention the column name but receives a message my ColumnName does not part of a Data Table.

This screenshot Trims all the columns and works fine but I want to mention the single column name in the assign activity.

If you are trying to remove emptyspaces from all the columns, I dont think you need an assign col.ColumnName.

CurrentRow(col.ToString) = CurrentRow(col.ToString).ToString.Trim will work fine.

This is because the outerloop handles both Column names with or without spaces and when we reference the column name in the inner loop we can just call CurrentRow(col.ToString)


If you want to only remove from one column then you can remove the outer loop and only use the inner loop as I mentioned above

In your case, it will be
CurrentRow("YOURCOLUMNNAME") = CurrentRow("YOURCOLUMNNAME").ToString.Trim

"YOURCOLUMNNAME" can be saved as an argument or variable if you want to do so.

1 Like

Thanks @jeevith for your very detailed swift response. Issue is resolved now.

Many thanks & kind regards,

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