Need to split only one column and update in the same column

Hi all,

I have a csv file…
In one column i have a value as 06/17/2024 (06/17/2024) i need to split the value before space i need the value in same column as 06/17/2024. I don’t need to update need column only this column i need change.
Is there any solution

Hi @vaish

Try this

dt.AsEnumerable().ToList().ForEach(Sub(r)
            r("Column") = r("Column").ToString().Split(" "c)(0)
End Sub)

image

Regards,

Hi @vaish

Check the below sequence for your better understanding,
→ Use Read CSV activity to read the CSV file and store in a datatable called dt_Input.
→ Use For each row in datatable activity to iterate the each row in the dt_Input datatable.
→ Inside for each insert the Assign activity. Imagine Column name is ColumnC. Give the same expression in the Assign activity.

- Assign -> CurrentRow("ColumnC") = CurrentRow("ColumnC").toString.split(" ").First

→ Outside of For each row in datatable activity, insert the Write CSV activity to write the dt_Input to Same CSV file and same sheet.

It will automatically update the whole ColumnC by splitting with space and write the Required result.

Hope it helps!!

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