Copy excel column

i am trying to insert column after column name"2019". and copy column"2019 " and paste it into next column. and edit 2019 to 2020.
check attached file.
New Microsoft Excel Worksheet.xlsx (10.3 KB)

Hey @monikanimbalkar

You can use simple set of activities to achieve this…

  • Use read range to read the data of the column “L” which has 2019 data. For the range property Specify L1 So that that column will only be read into a datatable… Read it without headers.

  • Now, do a update for the value in DT.Columns(0)(0) to 2020 using an assign activity

  • Now use a write range on the same sheet. For this, for the range, specify M1. Write without headers and you will have the output you need.

Hi
In addition to what @Lahiru.Fernando suggested The steps involved will be as follows
—use excel application scope and pass the file path of excel as input and inside the scope use read range activity and get the output with variable of type datatable named dt
—now use a assign activity like this
int_index = dt.Columns.IndexOf(“2019_columnname”)
Where int_index is a variable of type int32

—now use a Invoke Method activity and mention
the property like this

  • TargetType - (null)
  • TargetObject - dataTableName.Columns(“YourColumnName”)
  • MethodName - SetOrdinal

Then in the Parameter Properties tab of the activity, mention as

  • Direction - In
  • Type - Int32
  • Value - int_index

Now this will add a new column next to the column 2019 in our datatable

—next use a FOR EACH ROW activity and pass the datatable dt as input and inside the loop use a assign activity like this
row(“yourNewcolumnname”) = row(“yourcolumnname”).ToString

This will copy all the value to the new column which can be written to excel with Write range activity

Cheers @monikanimbalkar

2 Likes

Main.xaml (20.6 KB)
check this xaml file…and suggest me how to solve.?

1 Like

Main.xaml (9.7 KB)

@monikanimbalkar Please find the attachment for the same . Data is copied from last column and pasted it in next with incremented header .

Thanks
Himanshu

1 Like