Update column header

I have a column called “Name” in a datatable variable, I want to update it to “FirstName”. How do I go about this? I found there’s no activity in UiPath to do this?
I followed the below steps-
Let’s say you have a DataTable variable named dt, and you want to update the column header from “OldColumnName” to “NewColumnName”. Here’s how you would configure the Assign activity and the Invoke Method activity:

  • Assign Activity:
    • To: column (Create a new variable with this name of type System.Data.DataColumn)
    • Value: dt.Columns("OldColumnName")
  • Invoke Method Activity:
    • Target Object: column
    • Method Name: SetColumnName
    • Parameters: "NewColumnName"

but there’s an error " datacolumn does not have a public instance method “SetColumnName”

I used this and it worked-

  • First Assign activity:
    • To: column
    • Value: dt.Columns("OldColumnName")
  • Second Assign activity:
    • To: column.ColumnName
    • Value: "NewColumnName"

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