How to merge columns of two datatables and convert it to excel

Hi All,

Could you please let me know how to merge columns of two datatables and convert to excel.
Steps which I followed.
1.DT1 = Name ,Id
2.DT2=Status, Company
3. Used Merge datatable to merge DT1 and DT2.
4.Write range excel to convert datatable to excel.

Result I got in excel is
Name Id Status Company
aa 01
bb 02
Success abc
pending xyz

Expected result in excel is:
Name Id Status company
aa 01 Success abc
bb 02 pending xyz

Could you please help on this.

@Nancy29

If you just need them side by side…then use two write rnage acitvities one with cell as A1 and other with C1

cheers

Hi @Nancy29

  1. Create a new datatable (DT3) which include the columns “Name”, “Id”, “Status”, and “Company” columns.

  2. Loop through the rows in the merged datatable (DT1 and DT2) and add each row to DT3 in the desired format. For example, you can use the “Add Data Row” activity to add a new row to DT3 with the values from the merged datatable in the desired order.

  3. Use the “Write Range” activity to write DT3 to an Excel file.

Hi @Nitya1 @Anil_G

Thanks for your quick reply. Let me try with both the methods and see if I can get the solution.

1 Like

Thanks a lot. It worked.

1 Like