How to call data from a excel array

Hi,
I am trying to create a bot that extract data from excel, select data from the second and fourth column (B and D), set the value as a variable inside a loop where iterates over every row until end the columns.

Screenshot_2

Screenshot_2

1 Like

Hello @Yoshi,

To be able to loop through an array from the table you would first need to use the activity Read Excel file. once you have read the file in studio pro, your variables tab is where you would find the data from the table. (e.g: excel_content).

When you click to view the data, at the top you will see show source value, if you check that box, you will be able to see the array created from the data of the table.

to be able to create a loop of columns B and D, you would need to use the Do-While loop activity. you set up the parameters following the setup instructions listed at the top of each activity.

When setting up your if then statement you want to be sure that you indicate if I is less than or equal to (insert # of rows that are filled)

once you get to your yes or no branch you will need to replace the comment block with 2 assign value to variable activities.

Using calculate a value.

To pull info from column B you would define your parameters by inputting : excel_content[“insert sheet or tab name”][i][“year_num”]

for column D you would use excel_content[“insert sheet or tab name”][i][“month_num”]

after those blocks insert the console log activity and define the parameters as calculate a value and the indicate (variable1 name + " " + variable2 name)

this results in the data from column B and D in the console Log. If this works you will know how to place the info elsewhere.

For more information on how to set up the do-while loop please take a look at this article.
Using The Do- While Loop

2 Likes

Do a simple loop, with the counter starting on 2.

I’m not with the studio opened but you have something like read cell, where row = the counter and a fixed column B or D.

The value can be stored in a variable and you go to the end. You can get the end line with the “.length” in calculated value but you can switch the loop with a “while variable different than nothing”.

2 Likes