# 2 Datatables

**URL:** <https://forum.uipath.com/t/2-datatables/563395>\
**Category:** Studio\
**Tags:** workflow-diff, question, studio, system, activities\
**Created:** [July 14, 2023, 11:13am UTC](https://forum.uipath.com/t/2-datatables/563395 "2023-07-14T11:13:29Z")\
**Posts on this page:** 6\
**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:** [July 14, 2023, 11:13am UTC](https://forum.uipath.com/t/2-datatables/563395/1 "2023-07-14T11:13:30Z")

</div>

Hi Team,

Inputs are 2 datatable:

 ![image](https://global.discourse-cdn.com/uipath/original/4X/e/3/b/e3b198bddc92a6df34b9e26eabbb31a8e07b48e2.png)

![image](https://global.discourse-cdn.com/uipath/original/4X/5/b/e/5be201ccbf6156846a969ea509f74424acdd8c1d.png)

Output:

 ![image](https://global.discourse-cdn.com/uipath/original/4X/1/d/e/1de777af1cc73c7ffeb12663effb0684dbac9adf.png)

---

<div class="post-metadata">

**Author:** ![adiijaiin](https://sea2.discourse-cdn.com/uipath/user_avatar/forum.uipath.com/adiijaiin/32/523523_2.png) [@adiijaiin](https://forum.uipath.com/u/adiijaiin)\
**Post date:** [July 14, 2023, 11:17am UTC](https://forum.uipath.com/t/2-datatables/563395/3 "2023-07-14T11:17:16Z")

</div>

HI @yash.choursia

Try to loop through the first DataTable  
and use a lookup datatable in on 2nd datatable, based on Material keyword. (Assuming in 2nd Datatable there should be common field to map plant against something.)

Get the value from LookUp \> ValueFound  
and use an assign activity: currentRow(“Plant”)= ValueFound.

Exit loop

Thanks  
Happy Automation! 😃

---

<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:** [July 14, 2023, 11:19am UTC](https://forum.uipath.com/t/2-datatables/563395/4 "2023-07-14T11:19:41Z")

</div>

i dont have any key here. i just need to add the column

---

<div class="post-metadata">

**Author:** ![adiijaiin](https://sea2.discourse-cdn.com/uipath/user_avatar/forum.uipath.com/adiijaiin/32/523523_2.png) [@adiijaiin](https://forum.uipath.com/u/adiijaiin)\
**Post date:** [July 14, 2023, 11:21am UTC](https://forum.uipath.com/t/2-datatables/563395/5 "2023-07-14T11:21:47Z")

</div>

and would there be any no of rows or just one plant value?  
If there’s gonna be one plant value  
just simply use Read Cell activity, store the data in a variable ValueFound

Loop through DT1:  
assign CurrentRow(“Plant”)= ValueFound.  
exit loop.

Write Range to get your result.

Thanks

Happy Automation! 😃

---

<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:** [July 14, 2023, 11:28am UTC](https://forum.uipath.com/t/2-datatables/563395/6 "2023-07-14T11:28:25Z")

</div>

Hi @yash.choursia

Follow this:

1. Get the column by using:(dt is 2nd datatable)  
`col = dt.Columns(0)` for getting the 1st column in datatable(plant)
2. Use insert column activity to insert the column.

---

<div class="post-metadata">

**Author:** ![Anil\_G](https://sea2.discourse-cdn.com/uipath/user_avatar/forum.uipath.com/anil_g/32/524291_2.png) [@Anil\_G](https://forum.uipath.com/u/Anil_G)\
**Post date:** [July 14, 2023, 11:34am UTC](https://forum.uipath.com/t/2-datatables/563395/7 "2023-07-14T11:34:28Z")

</div>

@yash.choursia

Easiest way would be read the plant table and then use write range with B2 as the range and plantdt as the datatable

cheers
