Get the first name and last name from excel file and insert into respective fields in website

I have an excel, where i have 2 columns, namely firstname and lastname. When i run uipath, it should ask me how many records you want to fetch, if i select 3, then i should be able to retrieve 3 rows from excel and create 3 different records in website.
I have almost finished the above requirement with onething pending. I would like somebody to help me with the idea.

Let me explain the process I followed.

1)Input Dialogue
2)Excel Application Scope
3)sequence
4)read range(used " ")
Once I fetched all the rows from excel then I will call website.

5)Open Browser
6)do while
Now here how can i retrieve first row and assign it to the website and when it loops second time, how can i retrieve second row and insert it to website…so on…

@Rajesh_Acharya, There are multiple ways.

  1. Use for each loop and initialize a counter inside. Every time compare counter with the input value. like counter <= input. if condition comes to false then use break to get out of the loop.

  2. You can use sql query to select top 3 records only.

  3. You can use query on the data table to get only 3 records

Inside loop insert data into the website.

#HappyRobotics

1 Like

Is it possible iterate using do while?

Fine
do you want all the column values to be used in website or any specific column value
@Rajesh_Acharya

1 Like

Yes it is. While counter<=input and inside while dt.rows(“ColumnName”)(counter).value

Cheeers!!

1 Like

i have 2 column firstname and lastname, consider i have 3 rows in excel, now when the loop starts it should pick first row then insert into the website and click submit, again second row, retrieve 2 columns of second row and insert into the website and submit.,so on, so number of time it loops is depends on the number i entered in input dialogue,and say i am storing that value in variable “count”

1 Like

In Read range activity, I have set datatable name as DT1, but what must be the column name, when i tried like this i got error DT1.Rows(“Name”)(count).value saying “Compiler error(s) encountered processing expression “DT1.Rows(“Name”)(count).value”.
Option Strict On disallows implicit conversions from ‘String’ to ‘Integer’.”

1 Like

Fine hope these steps would help you resolve this
—use input dialog box and get the input from user and get the output from the activity with a variable of type string name str_input
—now use a excel application scope and pass file path of excel as input
—inside the scope use read range act and get the output with a variable of type datatable named dt
—now use a while loop and mention the condition this
counter < Convert.ToInt32(str_input)
Where counter is a variable of type int32 defined in the variable panel with default value as 0
Inside the loop use a assign activity like this
Str_value1 = dt.Rows(counter)(“yourcolumnname1”).ToString
And another assign activity like this
Str_value2 = dt.Rows(counter)(“yourcolumnname2”).ToString
And final assign activity like this
Str_value3 = dt.Rows(counter)(“yourcolumnname3”).ToString

Where all these three variables are string variables

And finally use a assign activity like this
counter = counter + 1

Followed by this use open browser activity and use these three variables
So until the mention the user input this will iterate and the values will be used

Cheers @Rajesh_Acharya

2 Likes

Thank you so much bro, that was great help for me… :slight_smile:

1 Like

Cheers @Rajesh_Acharya

1 Like

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