Iterate over Excel file to automate SAP GUI

I have an Excel file that looks like this:

I want to automate filling out a SAP GUI.
How do I iterate through each row so that when the script is run, it fills out SAP with the items from row 2, then row 3, then row 4?

I’ve successfully automated filling out the items in SAP if I only need one row of items, I just need help with the iteration part.

You need to use an Excel function to put all the data in a Table variable, and then loop through it using For Each…so something like this:


This doesn’t actually iterate through each line item though. It just uses line 2 three times because there are 3 rows of data.

It should iterate through each row, assuming you have the correct table selected, and iterate By rows selected


Are you assigning the values to variables within the For Each loop?

So like in your example, company_code would be ${element[1]}, business_area would be ${element[2]}, and so on

How do I assign values to variables within the table?

Here’s a larger screenshot than you need (also, note I have two For Each loops, the first one is looping through a list of files), but just so you have more context.

But anyway, you use the syntax over in the right: ${element[1]}