I am quite new with UIPath and I need some help to solve a problem for work.
I have to fill fields in the first picture using the Excel file in the second one, in particular I’d like to know how to set arguments in the argument panel. For example, how can I choose the first couple?
1.read the excel using read range output as dt
2.for each row pass the output as dt
3. crate one variable UserName=CurrentRow(“username”).ToString
4.create one more variable for password Password=CurrentRow(“password”).ToString
5.and take one type into indicate it on screen and pass the UserName variable
6.Take one more type into and pass the Password variable
7. just use the click activity and indicate it on accedi.
Note: Check the selectors for every activity which you indicated
if you wants do it with arguments have a view on this thread
First of all storing credentials in the excel is not best practice. please store your credentials in the orchestrator as credentials asset with the name as username you mentioned in the excel file.
→ using Get credential activity to retrieve the username and password from the orchestrator. input parameter will be Asset name(i.e username in our scenario) and output will be username and password from the orchestrator.
->To input the key name(username). the excel should have only usernames not passwords. All the usernames we have to read by using read range activity and store into data table. use for each row activity to loop the usernames one by one and get the specific credentials and enter the username and passwords to the application you mentioned.
If you specifically want to target a ‘couple’ from the excel you can try:
Read Cell and target the specific cell you want
Or, stull using read range, and analysing the datatable:
This will directly give you the username of the 2nd row. (the index counter in the expression starts at 0).
If you have to process the entire list better to use the for each row example in the previous posts.
If your use case it to consult the excel for credentials to log in to an application… indeed store the credentials in the credential vault instead of using excel. Your excel document is every hacker’s wet dream…
Yes, I meant the first row, but I don’t need the iteration for each one: I’d like to know how I can set specified credentials in the datatable in variable panel according to the test case I need to run in that moment.
if you wants to use only first rows. no need to read excel just do the follow.
1.Take one type into and indicate it on UserName field and just pass the string like this “unxqtv1”.
2.Take one more type into activity indicate it on password field and pass the string like this “gr0upama”.
3.Take one click activity and indicate it on Accedi. you will successfully log in to the page.
If you only want the first row credentials if I understand correctly from data table, you can simply use : <Datatable_Variable>.Rows(<row_number>)(column_index>).ToString
Here, <Datatable_Variable> will be the name of your datatable variable as you can see in the variable panel.
<row_number> will be starting from 0 to N-1. It means if first row, then use 0 here.
<column_index> will be starting from 0 to N-1. It means if first column, then also use 0 here.
For example if you want the first pair of credentials, create two variables username and password and set the values using Assign activity as:
I used “Excel Application Scope”, put file path in, then “Read Range” with the sheet name I have to use, create DataTable variable as “dtCredentials”, strUsername=dtCredentials.Rows(4)(0).ToString, strPassword=dtCredentials.Rows(4)(1).ToString, but when I run it I have this error message: