How to rename the column name in datatable…
Hello @Devendra_Bhardwaj ,
Please check this solution:
Assign activity: yourDT.Columns(0).ColumnName = “New Column Name”
The 0 is the column index, which you have to set for whichever column you want to rename. 0-based index, so if you want to rename the third column you’d use Columns(2)
Or you can reference by column name…
yourDT.Columns(“Old Column Name”).ColumnName = “New Column Name”
Hope it helps!
Best regards,
Marius
Hey that means that any of your variables in the write range activity is null, please debug your process and see what’s happening
Regards
Hello @Devendra_Bhardwaj ,
For the instruction to change the column name, please use an assign activity (https://docs.uipath.com/studio/docs/the-assign-activity ) not an Write Line activity.
To check you can use this sequence:
Write line: yourDT.Columns(0).ColumnName
Assign: yourDT.Columns(0).ColumnName = “New Column Name”
Write line: yourDT.Columns(0).ColumnName
Carefully check again Paul’s solution:
Assign activity: yourDT.Columns(0).ColumnName = “New Column Name”
The 0 is the column index, which you have to set for whichever column you want to rename. 0-based index, so if you want to rename the third column you’d use Columns(2)
Or you can reference by column name…
yourDT.Columns(“Old Column Name”).ColumnName = “New Column Name”
Best regards,
Marius