How reorder columns from excel

Dear Experts,

What i want to know is how can we swap columns in excel, for example, i want to swap the whole column data A to B. that will be look like A(PO Date), B(PO No).


Let me know any idea for that one, thanks.

1 Like

May i know why do you wanted it to do?

Your requirement pls

Hi Karthick,

We have another software that read with index name not column name which is currently using,
current excel file is finalized with uipath such as deleting columns and so on. But some column area are mismatching and we need to swap it to the correct order as below.

PO Date, PO No, Delivery Date, Currency, etc

So we only want to know how can we swap these columns in ordinal.
We also assign dt as follow for write range:
InputDT.AsEnumerable.Where(Function(x) row(“PONumber”).ToString.Contains(x.Field(Of String)(“PONumber”).ToString)).Select(Function(y) y).CopyToDatatable

Let me know if you can fulfill my requirement
Many thanks.

Name, id, email
and you need name , email, id

you can use invoke method to do it
Targettype= null
Target object: DatatableName.Columns(“Name”)
Method name: SetOrdinal

Targettype= null
Target object: DatatableName.Columns(“email”)
Method name: SetOrdinal

Targettype= null
Target object: DatatableName.Columns(“id”)
Method name: SetOrdinal

print the data table again , columns will be udpated


There are 2 ways

  1. use Set Ordinal Method

Hi shanmuck,

Can i get some sample xaml for your suggestion?

@Htwe_Ko_Ko_Wynn Use Filter Datatable Activity, And in Output Columns Section, Assign the Column Names in the Order you need it.


Thats also a very good approach

1 Like

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