How to loop through rows and columns in an excel and pass them to a webpage

excel
activities

#1

Hi,

I need to capture data from each row and each column and pass them to a webpage to login.

Excel:
usrname password
user1 pswd1
user2 pswd2
user3 pswd3

webpage
username-textbox
password-textbox

How do i do this?

I started of by

  1. Read Range activity to read data present on the excel.
  2. created a variable to read the column count in to.

I am looking for how would i fetch and pass them to webpage in a loop


Read row by row and column by column in excel
#2

Follow the below steps:

  1. Use ‘Excel Application Scope’ activity and Add ‘Read Range’ activity inside the scope.
  2. Create a DataTable variable and assign it to the output property of Read Range activity. Not all your username and password date is in that DataTable variable. Lets say it is dtCredentials.
  3. Now use a ‘For Each Row’ activity after the ‘Excel Application Scope’ activity.
  4. Add ‘Assign’ activity inside the for each loop and create string variables named ‘strUserName’. Assign should be like this “strUserName = row.item(0).ToString”
  5. Add another ‘Assign’ activity next to the first assign activity. Create another string variable named ‘strPassword’. Assign should be like this “strPassword = row.item(1).ToString”.
  6. Add an ‘Open Browser’ activity with the login page url.
  7. Add a ‘Type Into’ activity inside the Open Browser activity and indicate your username textbox.
  8. Pass the value of the text as ‘strUserName’.
  9. Add another ‘Type Into’ activity after the 1st one and indicate your password textbox.
  10. Pass the value of the text as ‘stePassword’.
  11. Add a ‘Click’ activity and Indicate your submit button.

Note: Step 4 to Step 11 should be inside your for each row loop.

Thanks,
Rammohan B.


#3

Thank you so much for your help.

If a third column has to be added to the excel (Ex:URL), should that also be assigned for ‘row.item(0).ToString’?


#4

No, It should be row.item(2). Number represents the index of the column.

Thanks,
Rammohan B.