Iterate the excel till it reaches last row

Hi all,

My bot has to read data from the excel and populate it on webpage one by one.
Like it read first row then it will populate all the data on webpage and click ‘CONTINUE’.
It has to click ‘CONTINUE’ on webpage till it fetches all the data from excel and populates on webpage and when it reads the last row from excel and populates the data on webpage then it has to click on ‘checkout’
anyone please help on this.
I have given an excel example

@Florent_Salendres

test.xlsx (8.0 KB)

1 Like

Can you try with using counter

1 Like

Can u provide a xaml showing it’s use

1 Like

From my understanding, you case looks pretty similar to the RPA challenge bellow.

You can have a look on the solution proposed (avoid the one using javascript etc…)

Basically, you should use read range to obtain a datatable and loop through your page.

In those example, mostly people try to manage different fields with only one TypeInto/SetText and a dynamic selector. In your case you could probably have more than one activity to do so.

Without having access to underlying system to build selector, I am afraid we cannnot do much more than this.

Cheers

1 Like

Hi,

You can take a counter variable and use a condition inside a for each and use if condition counter<(Datatable.rows.count-1) and increment the counter for each row and we it reach the last row counter is equal to Number of rows in the table and condition will be false and you can click on checkout.

1 Like

I would use a similar approach @anil5 is using. Inside the for each, simply place an IF (flow decision) that reads datatable.Rows.IndexOf(row) < datatable.Rows.Count. When true, continue with normal process. When false, you have now reached your last record.

1 Like

will the counter be increased inside foreach or outside forech??

1 Like

Hi,

So if you see the properties of for each, the output of for each is a counter variable of int type, which will make a count of how many has been iterated.

It should actually be datatable.Rows.Count - 1 because row indexes start at 0 and the count starts at 1.

1 Like