Add Column name1

I have added one column through add column row but its coming in last position i want to add index of 1 in excel how to do this?

Hi @Kuldeep_Pandey

  • Use the “Invoke Method” activity to invoke the “SetOrdinal” method of the columns collection of the data table.
  • Pass the column name and the desired position index as arguments to the “SetOrdinal” method.

Hope this helps,
Best Regards.

1 Like

I have done but its giving error in null

Hi @Kuldeep_Pandey
Using this query you can arrange the column.
dt_input=dt_input.DefaultView.ToTable(False,“Column1”,“Column2”)

Pass your data table column names in the place of Column1, Column2…

Hope this helps

@Kuldeep_Pandey

Try doing it like this:

  • Target Object: DataTable.Columns
  • Method Name: SetOrdinal
  • Parameters -
  • Parameter 1: “ColumnName” (Type: String) - the name of the column you want to move.
  • Parameter 2: “Position” (Type: Int32) - the zero-based index of the new position for the column.

Best Regards.

Hi @Kuldeep_Pandey ,

Let us know what have you implemented. Maybe a Screenshot of the implementation would help us navigate to the cause and provide a fix suggestion.

image
Error

@arjunshenoy

You can do it using read range. first read range which you want to be in 1st place then get then the remaining columns giving seprate range. firstly get the count and save it some variable

now write range using same Range like “A1:C”+RowCount and then put your middle column as range D1:D+RowCount and then write remaining rows like “E1:BG”+RowCount

1 Like


See My parameters

@Kuldeep_Pandey ,

Try setting it as mentioned by @arjunshenoy in the post above.

Let us know the details after.

Hey @Kuldeep_Pandey
Can you just try with what @Suraj_B_Shetty mentioned?

That worked for me

Input :
image

Output :
image

Regards,

Hey please try this workflow it will help you to set the column in the desired position you need.

SerOrdinal.xaml (8.6 KB)


Regards

Sreejith S S