Add Column and make it as the FIrst Column

Hello all. I want to add a column and make it as the first column.
How to do it? Because when I add a data column, it is added as the last column.
Please help and thank you in advance.
@Jan_Brian_Despi

3 Likes

Hi @Milbert_Dacudao!
So what you need to do is after you add the data column, use an Invoke Method activity.
Setup the activity using the info below:

  • TargetType - (null)
  • TargetObject - dataTableName.Columns(“ColumnName”)
  • MethodName - SetOrdinal

Then in the Properties tab of the activity, add a parameter:

  • Direction - In
  • Type - Int32
  • Value - 0

The Value is 0 because it is the index of where you want to move the column. You may want to change it depending on where you want the column to move.

Then you may want to use a custom activity from UiPath Go! for this one. Check it from the link below:
https://go.uipath.com/component/datatable-setordinal-70541

Hope this helps.
Thanks and regards.
Despi

14 Likes

@Milbert_Dacudao

Use Insert row/Column activity and specify position as ‘0’ to add it as first column. For your reference please find the below thread:
https://activities.uipath.com/docs/excel-insert-column

If you face any issue then please let me know.

2 Likes

Hi @lakshman.
I forgot to say that it is a data table so the answer of @Jan_Brian_Despi is working for me. :slight_smile:

3 Likes

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