Text variable to Excel, compare and find missing items

Hello, maybe a trivial question, but I still have no answer. Through Get Text activity I get text from web page, for example “Text1”, “Text2” etc, one by one. I would like to:

  1. copy all these items to Excel ABC.xlsx as a data table
  2. compare that Excel with another Excel DEF.xlsx and find, what items, that are in ABC.xlsx, are missing in DEF.xslx

Could you please help with any idea how to make this working?

Thank you!

Marian

Hi
Hope these steps would help you resolve this
—use a excel application scope and pass the file path as input
And inside the scope use a read range activity and get the output with a variable of type datatable named dt
—now use a assign activity like this
finaldt = dt.Copy

Now use a clear datatable activity and mention the input as Finaldt
Where Finaldt is a variable of type datatable with default value as New System.Data.Datatable

—now next to this keep the get text activity and store them in a variable named str_input
And if it’s inside a loop then next to this get text activity use a ADD DATA ROW activity and mention the ArrayRow property as
{str_input.ToString} and Finaldt as datatable property input /// assuming that you have only column in ABC and DEF excel as well
Or we need to mention n number of elements in that array row property which is equal to the number of columns in mentioned datatable

Now once after this loop to find the matches and unmatched data between two datatable kindly have. A view in this thread

Cheers @Majo

Hey there,

First question : Would it possible to get data from the webpage directly in a datatable by using Web Datascraping ? I think it would be much easier.
Second question : Solution depends on how looks your ExcelDEF file

Anyway, one way to do it would be something like that, but you have options :

  • Get all your Text variables (Text1, Text2…)
  • Create a DataTable with Activity Build Datatable (Table1)
  • Add a row to this DataTable with Activity Add Row Activity ({Text1,Text2,Text3…})
  • Read range ExcelDEF in order to have another datatable Table2
  • For Each Col in Table2.Column (Type Data.DataColumn)
  • Assign element_table2 = table2.Rows(0).Item(col).ToString
  • For Each Col2 in Table1.Column (Type Data.DataColumn)
  • Assign element_table1 = table1.Rows(0).Item(col2).ToString
  • If Activity : If element_table1 = element_table2 Then Nothing Else Log element_table1 missing

Best regards,

Thank you both for your answers and help!