Create variable based on the data table entries

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…

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

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

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

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

2 Likes

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

@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 :sweat_smile:

How can i implement this in my workflow

@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

2 Likes

follow same as suggested by @supermanPunch

Thanks

@Muhammed_Yaseen Did the Solution work? :sweat_smile:

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

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

got it.

Please help me assign those dictionary values to existing variables…

@Muhammed_Yaseen What Exactly Do you want to Do?

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

@Muhammed_Yaseen Checking the Key with?

key with existing variable

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