Solved

Looping 2 Columns in excel


Badge +1

I have a spreadsheet with several columns, I want to Read Column A (Order Number)
I need to take that Order Number and lookup it in our ERP (In web Browser)
Then I need to Read Column B (Order Charge) and paste that value in a box on the ERP within that order

After I need it to loop through all of the records within the Spreadsheet. 

The bot will loop through either the Order Number or Order Charge but not both, any suggestions?

icon

Best answer by MaggieW103794 6 June 2023, 21:06

View original

8 replies

Userlevel 6
Badge +15

Hi @jbarretto ,

The bot will loop through either the Order Number or Order Charge but not both, any suggestions?

If both fields contains the data (Order Number or Order Charge), you can loop the any one of the field. or If not contains data, you can use if conditions check the field value empty or not then loop the value field and move further.

Userlevel 7
Badge +13

Hi @jbarretto ,

 

For better understanding, could you please share the snapshot of the loops ?

Badge +1

 

Badge +7

Use CSV open / read and assign to data table / close

then loop in data table and assign variables to a record variable, assign however many fields you need by column index, then perform actions. Like this

 

Also, be wary of using mouse clicks. you’re counting on it to click the exact same spot but elements can move depending on the site, window size, and resolution

Userlevel 7
Badge +13

 

 

I can see that you are using the List items to iterates through and also two list actions disabled before starting the loop. Are you sure that the Bot going inside your loop? 

If you are handling with Excel, you can use Loop → For Each row in Worksheet either from Excel Basic or Advanced (depending on the availability of Excel installed on your PC).

 

 

Badge +1

Use CSV open / read and assign to data table / close

then loop in data table and assign variables to a record variable, assign however many fields you need by column index, then perform actions. Like this

 

Also, be wary of using mouse clicks. you’re counting on it to click the exact same spot but elements can move depending on the site, window size, and resolution

This was very helpful thank You!, Just curious could you share how you have you loops setup? Also do i have to specify the table size in the variable Below. 

Using your setup i have it returning the values in a message box, but it still wont loop, I’m sure I’m doing something wrong just not sure what. 
 

 

Badge +7

@jbarretto  you’ve got the loop set up right and you are putting the row values into a record variable, which is correct. But your variable assignment is wrong. What you are saying is to return a very specific cell in the table, by referencing the table and column and row indexes. You need to reference your row variable and the column index you want. So, should look like: TableRow[0] to return value of the cell in column A. Then on the next iteration it goes to the next row, so forth, until the loop is broken.

Badge +1

@jbarretto  you’ve got the loop set up right and you are putting the row values into a record variable, which is correct. But your variable assignment is wrong. What you are saying is to return a very specific cell in the table, by referencing the table and column and row indexes. You need to reference your row variable and the column index you want. So, should look like: TableRow[0] to return value of the cell in column A. Then on the next iteration it goes to the next row, so forth, until the loop is broken.

This worked! I really really appreciate you and everyone else here taking the time to help me with this. Thank You!

Reply