Use two or more "for each row" in the same process

Hello everyone,

I need to fill out a bunch of forms using data from different columns of an Excel file. I was trying to use “for each excel row” to type into the fields in the form (changing the “range” and “source” of the Excel file for each one of the fields). However I noticed that the automation works only for the first row. When it loops, it only changes for the next row in the first “for each row” activity and remains in the same row for the rest of them. Can anyone help me, please?

I attach an example of my Excel file… Each column shows different attributes from the same sample (in rows).

Hey!

How you’re using For each row?

Could you please show us the snap…

Try like this:

CurrentRow(0).ToString.Trim

This will give you the First Column values

In each iteration you’ll get the each item from the first column

Try this and let me know

Regards,
NaNi

You can just use one for each row in datatable activity:

Each row will be defined in a local variable called CurrentRow, you can then access each columns data from that variable.
i.e. CurrentRow.Item(“CT”).ToString.Trim

For row 2 in excel, this would return 15
For row 3 in excel, this would return 18
For row 5 in excel, this would return 22 etc.

You can then access the other columns in a similar fashion:
Column B = CurrentRow.Item(“AMOSTRA”).ToString.Trim
Column O = CurrentRow.Item(“LINHAGEM”).ToString.Trim

I need to go through all the process (get the values of every column and paste them into the fields in the form), save the form and then loop to the next row. This is what I desgined:

I am currently using StudioX version and I believe these codes are used in Studio, right? If so, could you be more specific on where/how I use this codes in Studio, please?

so CurrentRow2 will be a local variable of the whole row.

You can use CurrentRow2.Item(“CT”).ToString.Trim in your type into.

It worked! Many thanks :grinning:

1 Like

Glad it works! Good luck and keep going :smiley:

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.