# Combine 2 datatables

**URL:** <https://forum.uipath.com/t/combine-2-datatables/563389>\
**Category:** Studio\
**Tags:** workflow-diff, question, studio, system, activities\
**Created:** [14. Juli 2023 um 10:52 UTC](https://forum.uipath.com/t/combine-2-datatables/563389 "2023-07-14T10:52:35Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![yash.choursia](https://sea2.discourse-cdn.com/uipath/user_avatar/forum.uipath.com/yash.choursia/32/366204_2.png) [@yash.choursia](https://forum.uipath.com/u/yash.choursia)\
**Post date:** [14. Juli 2023 um 10:52 UTC](https://forum.uipath.com/t/combine-2-datatables/563389/1 "2023-07-14T10:52:35Z")

</div>

Hi Team,

I have 2 datatables and want 1 column of my datatable to be inserted into the another datatable’s column.  
Input:  
Datatable1:  
 ![image](https://global.discourse-cdn.com/uipath/original/4X/1/4/4/144390b0ed620ba0b6696d9bbfd75106f3a3babe.png)  
Datatable2:  
 ![image](https://global.discourse-cdn.com/uipath/original/4X/f/4/8/f48269d552811470e16d7d15a822839e196e144b.png)  
Output DT:  
[Material,Plant,Storage Location,Material Type,Special Stock  
_,Li29,_,\*,  
]

Please help.

---

<div class="post-metadata">

**Author:** ![mkankatala](https://sea2.discourse-cdn.com/uipath/user_avatar/forum.uipath.com/mkankatala/32/484097_2.png) [@mkankatala](https://forum.uipath.com/u/mkankatala)\
**Post date:** [14. Juli 2023 um 10:55 UTC](https://forum.uipath.com/t/combine-2-datatables/563389/2 "2023-07-14T10:55:42Z")

</div>

Hi @yash.choursia

Use Merge Datatable activity.

Hope it helps!!

---

<div class="post-metadata">

**Author:** ![supermanPunch](https://sea2.discourse-cdn.com/uipath/user_avatar/forum.uipath.com/supermanpunch/32/133652_2.png) [@supermanPunch](https://forum.uipath.com/u/supermanPunch)\
**Post date:** [14. Juli 2023 um 10:56 UTC](https://forum.uipath.com/t/combine-2-datatables/563389/3 "2023-07-14T10:56:52Z")

</div>

> [@yash.choursia](#):
>
> I have 2 datatables and want 1 column of my datatable to be inserted into the another datatable’s column.  
> Input:

Hi @yash.choursia ,

Could you let us know how are we updating the data in the Datatable ? Do we have an ID column that we can match and then update ?

Also, do assure that when providing the Sample data/Masking Confidential data, preserve all the conditions and restrictions so that we can also apply it for the Sample data.

---

<div class="post-metadata">

**Author:** ![yash.choursia](https://sea2.discourse-cdn.com/uipath/user_avatar/forum.uipath.com/yash.choursia/32/366204_2.png) [@yash.choursia](https://forum.uipath.com/u/yash.choursia)\
**Post date:** [14. Juli 2023 um 11:04 UTC](https://forum.uipath.com/t/combine-2-datatables/563389/4 "2023-07-14T11:04:06Z")

</div>

No Columns to Match Arpan,Actually i just need to add a column of one datatable to another thats it. We can restrict our focus to adding the plant column of the 2nd datatable to 1st datatable.

---

<div class="post-metadata">

**Author:** ![yash.choursia](https://sea2.discourse-cdn.com/uipath/user_avatar/forum.uipath.com/yash.choursia/32/366204_2.png) [@yash.choursia](https://forum.uipath.com/u/yash.choursia)\
**Post date:** [14. Juli 2023 um 11:08 UTC](https://forum.uipath.com/t/combine-2-datatables/563389/5 "2023-07-14T11:08:02Z")

</div>

No, it is not working

---

<div class="post-metadata">

**Author:** ![rlgandu](https://sea2.discourse-cdn.com/uipath/user_avatar/forum.uipath.com/rlgandu/32/488436_2.png) [@rlgandu](https://forum.uipath.com/u/rlgandu)\
**Post date:** [14. Juli 2023 um 11:26 UTC](https://forum.uipath.com/t/combine-2-datatables/563389/6 "2023-07-14T11:26:48Z")

</div>

@yash.choursia

Hi,  
Read the datatable and then add a datacolumn give the column name of the column you want to get from the other excel  
Read the datatable of 1 column and store in datatable,to get the the column in range property  
“A1:A30”  
Take For each row in datatable  
Take assign  
var1=CurrentRow(“Column Name”).ToString  
Take another for each loop  
Write cell activity.

I hope this will work, Please give a try to my procedure

---

<div class="post-metadata">

**Author:** ![supriya117](https://sea2.discourse-cdn.com/uipath/user_avatar/forum.uipath.com/supriya117/32/412736_2.png) [@supriya117](https://forum.uipath.com/u/supriya117)\
**Post date:** [14. Juli 2023 um 11:44 UTC](https://forum.uipath.com/t/combine-2-datatables/563389/7 "2023-07-14T11:44:33Z")

</div>

@yash.choursia

Merge datatable gonna work if the two datatables have same name in your case.

---

<div class="post-metadata">

**Author:** ![supermanPunch](https://sea2.discourse-cdn.com/uipath/user_avatar/forum.uipath.com/supermanpunch/32/133652_2.png) [@supermanPunch](https://forum.uipath.com/u/supermanPunch)\
**Post date:** [14. Juli 2023 um 12:23 UTC](https://forum.uipath.com/t/combine-2-datatables/563389/8 "2023-07-14T12:23:28Z")

</div>

Hi @yash.choursia ,

If looking for a Direct Excel updation, we could also check with Read Range and Write Range with Handled Range property (As It is only one column and irrespective of row match)

![image](https://global.discourse-cdn.com/uipath/original/4X/0/7/e/07e521a359680546debdc34c3add8e30a10f094b.png)

Notice in the `Write Range` activity `Range` property, `"B:B"` is the column/range that is already known to you or we could find as well. So we only update it with a Datatable having 1 Column only to the One Range/Column in Excel (B).

---

<div class="post-metadata">

**Author:** ![system](https://sea2.discourse-cdn.com/uipath/user_avatar/forum.uipath.com/system/32/182466_2.png) [@system](https://forum.uipath.com/u/system)\
**Post date:** [17. Juli 2023 um 12:23 UTC](https://forum.uipath.com/t/combine-2-datatables/563389/9 "2023-07-17T12:23:37Z")

</div>

Geschlossen, am 17. Juli 2023 um 12:23 UTC

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