Get Column from one Data Table and Add it to Other

Dear Forum Members ,

I have two data Tables .
One DataTable consist of 2 unique columns with data .
Second Data Table consist of 1 unique column with Data .

I need to merge them .

Can anyone help ?

Any suggestion will be appreciated .

Thanks and regards
Sahil Garg

Any suggestions ?

Hi @Sahil_Garg

Can u share the screenshot the excel files ?

Hi Mate,

Sheet1

Sheet2

I have to get State column with data from sheet2 and add it into sheet1

@Sahil_Garg
with the assumption that all datatables are having the same row count, find demo here:
ZipperMerge_2DTs.xaml (10.8 KB)

Hi Mate,

Situation is that i don’t know how many columns are in Data table 1 , but for dt2 , it is fixed that it has 1 column.

Any solution, mate ?

@Sahil_Garg
so lets dynamize it. we will fetch dynamicly all rows from dt1 and 1 from dt2.
have a look here:
ZipperMerge_2DTs_V2.xaml (9.9 KB)

it is dynamicly creating the result table by cloning the column structure from dt1 and taking the first column from dt2 (Its mandatory that the names are unique)

for adding the merged date is also dynamicly as it is setup on itemArray base

Hi mate,

Your solution is good i appreciate it, but i dont know it is not working in my input data.

@Sahil_Garg
just add to the implementation

  • the read ranges to the different input excels
  • write range for dtResult to write out to excels
  • ensure that the variable names are correct or adopt

thats all

Thanks you so much :slight_smile:

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