Reading Data Table from website and comparing with an excel doc

Hi - I could use some help on my automation project.

I have a website that contains a data table (See screenshot below) and I have an excel file that has the same account numbers / names & also contains a value for each account (there are some accounts that have no value and are left blank). I want to look at the data table from the website and using the account number, check to see if the excel file has a value for a given account. If so, I want to write that account number in the empty “value” cell in the website.



1.Use the use browser/application activity.
2.Within that activity use the extract data table activity and extract the data from the website.
3.Read the entire excel using the read range activity.
4.Use the for each row in data table and pass the variable that stored the data of the extracted data from website.
5.Within for each row in data table use another for each row in data table and pass the variable that stored the data of excel.
6.Within second for each row in data table activity use the if condition and the syntax must be like CurrentRow(Account).Tostring.Trim.Equals(CurrentRow1(Account).Tostring.Trim.) and if the condition gets satisficed then it enters the then sequence of if condition.
7.Wthin the then sequence use the TypeInto activity and indicate the place where you want to write the value.
8.In TypeInto activity pass the syntax as CurrentRow1("Value").ToString.Trim and after this TypeInto activity use the break activity so that it reduces the execution time.

Note : In above mentioned process CurrentRow is the row of first for each row in data table activity and the CurrentRow1 is the row of second for each row in data table activity.

Hope it helps!!

Hi @R_Wolff

=> Take the Use excel file activity and pass the input excel file path.
=> Extract the datatable in the application as datatable by using the extract datatable activity. Output - extracted_dt (Datatable datatype)
=> Use for each row in datatable activity to iterate the extracted_dt rows. Output - CurrentRow1
=> Inside for each row in datatable activity insert the for each excel row to iterate the each row in excel. Output - CurrentRow2
=> Inside for each excel row activity insert the If condition, write the below condition

-> CurrentRow1("Account").toString.equals(CurrentRow2("Account").toString) and CurrenRow1("Description").toString.equals(CurrentRow2("Description").toString)

=> Inside If condition place assign activity and create a variable called value String (datatype). Store the value in excel file in this variable.
→ value = CurrentRow2(“Value”).toString (The value which is in excel file.)
=> After assign Insert the type into activity and indicate the value field in the webpage.
=> When indicating the element check the strict selectors and uncheck the fuzzy selector and image and validate.
=> Open the properties of strict selectors and select a attribute which is specific and pass the value variable to that attribute in Ui explorer and validate.

Hope it helps!!

Thank you both - it looks like the post was deleted, would you please be able to repost your answers?

1 Like

Thank you for the help on this so far - I am running into an issue where in the IF statement I’m getting error code BC30690: Structure “Integer” cannot be indexed because it has no default property. I have my CurrentRow1 and CurrentRow2 currently being stored as Int32 variables. Does this need to change?

Also as an FYI I don’t need to match the descriptions so I removed those from the above formula.

1 Like

If you are using the int then store it like

Cint(CurrentRow1("Column name").toString)

Same for the CurrentRow2.

Here we are converting the string value to integer by using Cint function.

Hope you understand!! @R_Wolff

Do I set that as a variable after the “For Each Row in Data Table” ? My output on the For Each Row in set at CurrentRow1 & CurrentRow2 but I’m not sure where you would put that function to convert.

No don’t need to create a int variables. Delete those variables first.
There are two for each loops rights we have changed CurrentRow in first for each as CurrentRow1 as for second for each we have changed to CurrentRow2 for clarification.

Hope you understand!!

Without having the variables it says that CurrentRow1 is not declared?

1 Like

Do you find the CurrentRow in For each row in datatable activity. It was created itself in for each row in datatable activity.

We have used two for each row in datatable activity right.

Change the first for each row in datatable activity from CurrentRow to CurrentRow1

Change the second for each row in datatable activity from CurrentRow to CurrentRow2

Hope you understand!! @R_Wolff

There is one more error in the variables you have created two extractdatatable variables. Delete one of them in activities panel itself. @R_Wolff

I’ve corrected the variables - now in my assign it says Cannot assign from Type System.Object to type System.String

1 Like

In the If condition the error is removed? @R_Wolff

Okay @R_Wolff

For which variables it was showing the error could you send me the screenshot of which assign activity.

Confirm me that what is the datatype of value variable, check it in the variables panel once and let me know @R_Wolff

The variable type is a string

Make a change it to System.Object datatype. @R_Wolff

awesome that seems to work - going to test input back into the website now

1 Like

Show me once what you have given in the value to save field in assign activity. @R_Wolff

1 Like