Excel column data

I have an Excel file with multiple URL’s And bot will read the input from the another excel sheet and as per the input we need to navigate to the particular website by getting the corresponding column data as out put.
Capture
For Ex: I have a input of Twitter and I want the corresponding column data(B5) in my output variable , same for the other inputs if the input is Google I want the column data( B2 ) as my output variable. Can some one help.

1 Like

Hi @Varunkumar_Saikumar
Hi use LookUp datatable activity for your scenario

Using lookup datatable activity u can lookup a value in the datatable in a particular column and then extract the corresponding column ie of url column corresponding to that row

Try that

Regards,
Nived N
Happy Automation

1 Like

@Varunkumar_Saikumar

Make a dictionary with key as “Name” and value as “URL”.
You can easily access the URL then by using the key

1 Like

@Varunkumar_Saikumar

Also you can try with Filter Datatable and later you can use as Dt.Rows(0).Item(“ColumnName”).ToString

Hope this may help you

Thanks

1 Like

There are multiple ways you can achieve this, below is my solution hope this helps.

Read the excel as data table ( URL_DT ).
Now if your Bot is getting input save it in a String Variable ( TargetName ) exmpl= twitter or yahoo etc
Use Linq query to get the Row Index of twitter as an example -

create a Integer variable and assign this Linq Query which will return the Row Index Number of your searched Company name which you need to pass using “TargetName= twitter” variable to this LINQ query.

Int Index = OutDT.Rows.IndexOf((From row in OutDT.AsEnumerable Where row.Item(“Name”).ToString.Equals(TargetName) Select row)(0))

Now use this index to get the value from URL column in DataTable

String varURL = OutDT.Rows(Index).Item(“URL”).ToString

Note: If you have duplicate company name in excel file it will return the first one from top as we are using (0) in LINQ query output.

Thank you guys for the help

@Varunkumar_Saikumar Mark the solution as solved.

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