Copy data from one excel to another excel using header wise

Suppose i have one excel Main.xls contains 3 columb A B C having data second excel contain 5 Columb A C D B
Now copy data of A B and C columb of excel one (Main) to second excel A B C and remaing columb D should be blank


Welcome to the community

Use read range and then use setordinal method to change the positions and use add data column to add new column…this way transform the datatable to destination format and then use write range activity to write back

Hope this helps


Also have a look at the merge datatable activity. It can handle different sets of columns from the 2 datatable and also, when the positions are different. Just give a try and explore it a little bit

Hi @vikas.mali

Can you try this-

  1. Use the “Read Range” activity to read the data from “Main.xls” and store it in a DataTable variable, let’s call it “mainData”.
  2. Create a new DataTable variable, let’s call it “updatedData”, with columns A, B, C, and D.
  3. Use a “For Each Row” activity to iterate through each row in the “mainData” DataTable.
  4. Inside the loop, use the “Add Data Row” activity to add a new row to the “updatedData” DataTable.
  • In the “ArrayRow” property, provide an array with the following values: {row("A"), row("B"), row("C"), ""}. This will copy the values from columns A, B, and C of “mainData” and leave column D blank in “updatedData”.
  1. After the loop is complete, use the “Write Range” activity to write the “updatedData” DataTable to the second Excel file.


Thanks i already tried that but issue is Excel Main is dynamic means sometime Coulomb A have data sometime Coulomb B have data

Above method will not handle dynamic excel(Main)