How to insert a column in excel based on a certain column name

Say I have 3 column Last Week, Current Week and Change. I need to only insert a new column every time before column Change

Is that possible ?

Somewhat like this I need to achieve

Scenario 1 :

image

Scenario 2 :

image

Hi @Ishan_Shelke
dt.Columns(“columnname”).SetOrdinal(dt.Columns(“change”).Ordinal)

Where should I write/execute this code exactly ?

Read the excel as datatable and use assign statement to write this code and then write it in excel

Getting the below error :

image

Give column name inside double quotes and show me full assign activity

On left hand side change it to data

You can find that position of Change column and store it in Integer variable… Then use assign for Degreement (position_variable - 1) …

For ex,

Position_int=Datatable_variable.Columns.IndexOf(“Change”)

Position_int = position_int -1

Use Insert Column activity pass table name, column name as you want and then in properties, position you may pass that decrement varible(position_int)…

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