How to insert a column between two existing columns in excel



Hi, regards to all

I’ve been using and learning UiPath for a couple of weeks now and I’m having some doubts with excel that hopefully you can help me solve.

The first question might be a simple one but I don’t seem to come with a simple solution: how can I add a new column between two existing ones directly in an excel sheet?

I know that there’s the Insert Column option within the table menu in the Excel app integration, but in order to do that, it appears to be that you need to have a table name, and in order to have a table name, you need to have a table (data formatted as a table). But is there a way to do it with raw data?

I’m sorry if it was asked before, I looked for it but didn’t find it, so that’s why I ask.

Excel Add column in between existing columns and Mapping of data from another Excel file

If you are doing using keyboard shortcuts to Insert Between A1 and B1

F5 —>type B1 —> Enter

Ctrl + Space —> Selects column B

Shift+Ctrl+"+" --> Adds Column before B (now C)

Enter Column Name —> Type Into

Ctrl + S —>Save


Hi vvaidya, thanks for your reply. I was thinking more in an “activities like” solution, one that does not imply having the excel file necessarily open. The method you mention is only usable in a recording sequence right?

Cheers and thanks again.


Take your excel into DataTable.-- Lets say Two Columns

Add Data Column — Add your new column.

Invoke Method Activity ---- dt.Columns(“NewColumn”).SetOrdinal(1) —> Will be the 2nd Column

Pass 1 in the Parameters in Properties


vvaidya, if it’s not too much trouble, could you show an image of the worflow? I can´t make it work and it seems I’m missing something.

According to what I understood of your reply, I pass my excel file to a DataTable, then I add the activity add data column and then the Invoke Method Activity with the command you specified.

This is the test flowchart I made:

It throws the next exception (it’s in spanish so the translation is not literal): The expression does not generate a value.

I would also like to suggest some improvements to the excel app integration, it would be nice to have some basics activities such as this one without that much trouble.



Share your xaml

dt.Columns(“NewColumn”)- Target Object

SetOrdinal - method

1(int) - parameter


vvaidya, the page doesn’t let me upload attachments. I’ll try to write it down in an understandable way (it’s the same presented in the image above).

DataTable name: DTtest (I changed the name in the image for security reasons)
Add data column values:

  • Column name: “New Column”
  • DataTable: DTtest

Invoke Method TargetObject: DTtest.columns(“New Column”).SetOrdinal(8)

I’m not sure if the column name must be the same in the “Add column” activity and in the Invoke Method activity.


Invoke Method

TargetObject: DTtest.columns(“New Column”)

Method : SetOrdinal

Parameters : 8 (int32)


Thanks vvaidya for your answers! Finally, and in honor of the time, I opted for the keyboard shortcuts method, of both options it is the one that adjust the most to what I’m trying to do.

Thank you so much for taking the time to answer me.



Good One