How to reorder columns in datatable

I have datatable with columns: URL, Location, Name. I need the ‘Name’ column as the first column. How do I do this?

Hi @shrutika

You can find your answer over here: :slight_smile:

I tried the given solution but I keep getting this error error

This is the invoke method:

Is there a way other than invoke method?

@shrutika did u set parameters in properties? Check also whether u assigned readrange output to datatable varibale u have declared

What parameters do I need to set?

@shrutika u have set target column number to where column name in invoke method should be moved.


above image is parameters property Like above image value represents to where u present column has to be moved. In image i am moving to first 2nd column(since column numbers starts from 0)

Thank you

Hi @shrutika

Here is a detailed article on that :slight_smile:
# How To Reorder Columns In DataTable – In UiPath



Hello Shrutika,

Try this, Use Filter Table Activity and then without adding any filter go to Output Columns section, here specify the order you want. Its easier this way and you have complete control over the range which you dont using thei invoke method.

Hope this solves the problem.

Better late than Never


Excel application scope

Modify the EXCEL file name

Hi mapkar,
This method is working can u explain your mode of approach

thanks and regards

Filter Data Table Activity

1 Like

In addition, Use the same DataTable variable in InputDataTable and OutputDataTable in Filter Table Activity.