# Create variable based on the data table entries

**URL:** <https://forum.uipath.com/t/create-variable-based-on-the-data-table-entries/191251>\
**Category:** Help\
**Tags:** datatable, gsuite, system, activities\
**Created:** [February 5, 2020, 4:41am UTC](https://forum.uipath.com/t/create-variable-based-on-the-data-table-entries/191251 "2020-02-05T04:41:05Z")\
**Posts on this page:** 20\
**Page:** 1

<div class="post-metadata">

**Author:** ![Muhammed\_Yaseen](https://sea2.discourse-cdn.com/uipath/user_avatar/forum.uipath.com/muhammed_yaseen/32/131696_2.png) [@Muhammed\_Yaseen](https://forum.uipath.com/u/Muhammed_Yaseen)\
**Post date:** [February 5, 2020, 4:41am UTC](https://forum.uipath.com/t/create-variable-based-on-the-data-table-entries/191251/1 "2020-02-05T04:41:05Z")

</div>

I have extracted data from a google sheet and saved it to a data table.  
It contains 2 columns and many rows.  
I need to create a variable based on the first column and save the second column as its value…  
Please help me to solve this issue…

---

<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:** [February 5, 2020, 4:44am UTC](https://forum.uipath.com/t/create-variable-based-on-the-data-table-entries/191251/2 "2020-02-05T04:44:31Z")

</div>

@Muhammed_Yaseen You cannot create a Variable at runtime i.e during execution of the Workflow 😅, What do you actually want to do ?

---

<div class="post-metadata">

**Author:** ![Muhammed\_Yaseen](https://sea2.discourse-cdn.com/uipath/user_avatar/forum.uipath.com/muhammed_yaseen/32/131696_2.png) [@Muhammed\_Yaseen](https://forum.uipath.com/u/Muhammed_Yaseen)\
**Post date:** [February 5, 2020, 4:47am UTC](https://forum.uipath.com/t/create-variable-based-on-the-data-table-entries/191251/3 "2020-02-05T04:47:13Z")

</div>

in my workflow i need to get all variables from a google sheet. how could i do that?

---

<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:** [February 5, 2020, 4:49am UTC](https://forum.uipath.com/t/create-variable-based-on-the-data-table-entries/191251/4 "2020-02-05T04:49:38Z")

</div>

@Muhammed_Yaseen Why do you call them as variables, you can call them as values, as they are values in a Google Sheet 😅 , ansd I guess you have already extracted the Values as a Datatable

---

<div class="post-metadata">

**Author:** ![Bhavik\_Solanki](https://sea2.discourse-cdn.com/uipath/user_avatar/forum.uipath.com/bhavik_solanki/32/137437_2.png) [@Bhavik\_Solanki](https://forum.uipath.com/u/Bhavik_Solanki)\
**Post date:** [February 5, 2020, 4:50am UTC](https://forum.uipath.com/t/create-variable-based-on-the-data-table-entries/191251/5 "2020-02-05T04:50:22Z")

</div>

Hello,

You may want to consider Dictionary object here instead, If you are sure there are 2 columns and if you are going to consider first column as KEY to access value in second column.

Happy Learning

---

<div class="post-metadata">

**Author:** ![Muhammed\_Yaseen](https://sea2.discourse-cdn.com/uipath/user_avatar/forum.uipath.com/muhammed_yaseen/32/131696_2.png) [@Muhammed\_Yaseen](https://forum.uipath.com/u/Muhammed_Yaseen)\
**Post date:** [February 5, 2020, 4:53am UTC](https://forum.uipath.com/t/create-variable-based-on-the-data-table-entries/191251/6 "2020-02-05T04:53:38Z")

</div>

how to store that extracted values to a variables one by one…

---

<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:** [February 5, 2020, 4:55am UTC](https://forum.uipath.com/t/create-variable-based-on-the-data-table-entries/191251/7 "2020-02-05T04:55:10Z")

</div>

@Muhammed_Yaseen As @Bhavik_Solanki Suggested I guess you need to Store them in a Key Order Fashion, If it is Alright by you we can try and Implement it 😅

---

<div class="post-metadata">

**Author:** ![Muhammed\_Yaseen](https://sea2.discourse-cdn.com/uipath/user_avatar/forum.uipath.com/muhammed_yaseen/32/131696_2.png) [@Muhammed\_Yaseen](https://forum.uipath.com/u/Muhammed_Yaseen)\
**Post date:** [February 5, 2020, 5:00am UTC](https://forum.uipath.com/t/create-variable-based-on-the-data-table-entries/191251/8 "2020-02-05T05:00:21Z")

</div>

How can i implement this in my workflow

---

<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:** [February 5, 2020, 5:02am UTC](https://forum.uipath.com/t/create-variable-based-on-the-data-table-entries/191251/9 "2020-02-05T05:02:08Z")

</div>

@Muhammed_Yaseen First Create a Dictionary Variable of String, String  
Then Assign this to it dict = new Dictionary(Of String,Striing)

Now, Since you already have your Datatable Values ready, Loop through the Datatable  
Inside the Loop, Use an Assign Activity like dict(row(0).toString) = row(1).toString

In this way All the values of Datatable will be Stored in the Dictionary

---

<div class="post-metadata">

**Author:** ![Manoj\_prabhakar\_R](https://sea2.discourse-cdn.com/uipath/user_avatar/forum.uipath.com/manoj_prabhakar_r/32/62804_2.png) [@Manoj\_prabhakar\_R](https://forum.uipath.com/u/Manoj_prabhakar_R)\
**Post date:** [February 5, 2020, 5:58am UTC](https://forum.uipath.com/t/create-variable-based-on-the-data-table-entries/191251/10 "2020-02-05T05:58:25Z")

</div>

follow same as suggested by @supermanPunch

---

<div class="post-metadata">

**Author:** ![Muhammed\_Yaseen](https://sea2.discourse-cdn.com/uipath/user_avatar/forum.uipath.com/muhammed_yaseen/32/131696_2.png) [@Muhammed\_Yaseen](https://forum.uipath.com/u/Muhammed_Yaseen)\
**Post date:** [February 5, 2020, 12:09pm UTC](https://forum.uipath.com/t/create-variable-based-on-the-data-table-entries/191251/11 "2020-02-05T12:09:03Z")

</div>

Thanks

---

<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:** [February 5, 2020, 12:18pm UTC](https://forum.uipath.com/t/create-variable-based-on-the-data-table-entries/191251/12 "2020-02-05T12:18:16Z")

</div>

@Muhammed_Yaseen Did the Solution work? 😅

---

<div class="post-metadata">

**Author:** ![Muhammed\_Yaseen](https://sea2.discourse-cdn.com/uipath/user_avatar/forum.uipath.com/muhammed_yaseen/32/131696_2.png) [@Muhammed\_Yaseen](https://forum.uipath.com/u/Muhammed_Yaseen)\
**Post date:** [February 5, 2020, 12:31pm UTC](https://forum.uipath.com/t/create-variable-based-on-the-data-table-entries/191251/13 "2020-02-05T12:31:20Z")

</div>

working on it.  
Can we print a dictionary through a message box?

---

<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:** [February 5, 2020, 12:33pm UTC](https://forum.uipath.com/t/create-variable-based-on-the-data-table-entries/191251/14 "2020-02-05T12:33:38Z")

</div>

@Muhammed_Yaseen No 😅, You have to Loop through Dictionary and Print it

---

<div class="post-metadata">

**Author:** ![Muhammed\_Yaseen](https://sea2.discourse-cdn.com/uipath/user_avatar/forum.uipath.com/muhammed_yaseen/32/131696_2.png) [@Muhammed\_Yaseen](https://forum.uipath.com/u/Muhammed_Yaseen)\
**Post date:** [February 5, 2020, 12:45pm UTC](https://forum.uipath.com/t/create-variable-based-on-the-data-table-entries/191251/15 "2020-02-05T12:45:36Z")

</div>

got it.

Please help me assign those dictionary values to existing variables…

---

<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:** [February 5, 2020, 12:48pm UTC](https://forum.uipath.com/t/create-variable-based-on-the-data-table-entries/191251/16 "2020-02-05T12:48:22Z")

</div>

@Muhammed_Yaseen What Exactly Do you want to Do?

---

<div class="post-metadata">

**Author:** ![Muhammed\_Yaseen](https://sea2.discourse-cdn.com/uipath/user_avatar/forum.uipath.com/muhammed_yaseen/32/131696_2.png) [@Muhammed\_Yaseen](https://forum.uipath.com/u/Muhammed_Yaseen)\
**Post date:** [February 5, 2020, 12:52pm UTC](https://forum.uipath.com/t/create-variable-based-on-the-data-table-entries/191251/17 "2020-02-05T12:52:50Z")

</div>

in my dictionary i have values needed to create and signup login session in my demo app.  
So i need to change only the excel sheet to change the values as per my requirement.

i have created 10 variables in the workflow. need to assign the values to those variables by checking the key.

Please help me

---

<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:** [February 5, 2020, 12:56pm UTC](https://forum.uipath.com/t/create-variable-based-on-the-data-table-entries/191251/18 "2020-02-05T12:56:41Z")

</div>

@Muhammed_Yaseen Checking the Key with?

---

<div class="post-metadata">

**Author:** ![Muhammed\_Yaseen](https://sea2.discourse-cdn.com/uipath/user_avatar/forum.uipath.com/muhammed_yaseen/32/131696_2.png) [@Muhammed\_Yaseen](https://forum.uipath.com/u/Muhammed_Yaseen)\
**Post date:** [February 5, 2020, 1:04pm UTC](https://forum.uipath.com/t/create-variable-based-on-the-data-table-entries/191251/19 "2020-02-05T13:04:23Z")

</div>

key with existing variable

---

<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:** [February 5, 2020, 1:12pm UTC](https://forum.uipath.com/t/create-variable-based-on-the-data-table-entries/191251/20 "2020-02-05T13:12:27Z")

</div>

@Muhammed_Yaseen When you say Existing variable, you mean the existing variabe name right?

[Next page](https://forum.uipath.com/t/create-variable-based-on-the-data-table-entries/191251.md?page=2)
