How to check if specific data is available or not in Excel using Uipath

Hi Team,

I have one excel with few columns I want check if B coloum has PDf and Non Billing or PDF and Billing or PDF Note and Billing.

If those data available in Excel i want to extract ACell data

For example if data is PDF and Billing is available in E4 column I want to extract A4 cell data dynamically using UiPath. Linq query

Input like this

Thanks in Advance

Hi @Baby123

What could be your output look like. The output is filtered rows or list of values in column A which meets condition.

Hi @Baby123

Try this:

aCellData = (From row In yourDt.AsEnumerable()
                 Where (row("B") = "PDF" AndAlso row("E") = "Billing") OrElse
                       (row("B") = "PDF Note" AndAlso row("E") = "Billing")
                 Select row("A")).FirstOrDefault()

Hi @supriya117 ,

I don’t have knowledge on Linq query.
Can you please explain and query and also I am getting below error.

Kindly suggest.

Hello @mkankatala ,
If Pdf and Billing data is available on Bcolum i just want to extract the cell index based on the index I will extract the A cell value.

Thanks in advance


Try this

Requiredvalue = dt.AsEnumerable.Where(function(x) x(1).Tostring.ToLower.Contains("pdf") AndAlso x(1).Tostring.ToLower.Contains("billing"))(0)(0).ToString


find some starter help here:
[HowTo] LINQ (VB.Net) Learning Catalogue - Help / Something Else - UiPath Community Forum

Try this one:
filteredData = excelData.AsEnumerable()
.Where(row =>
(row[“Logic”].ToString().Contains(“PDF”) && (row[“Logic”].ToString().Contains(“Non Billing”) || row[“Logic”].ToString().Contains(“Billing”) || row[“Logic”].ToString().Contains(“PDF Note”)))).ToList();

Hi @Baby123 try this; it will give us exact cell position.

InputDT.AsEnumerable.Where(Function(X) X("Logic").ToString.ToLower.Contains("pdf") AND X("Logic").ToString.ToLower.Contains("billing")).ToList().Select(Function(x) String.Concat("A",CInt(x(0).ToString)+1)).ToList()


List<string>(3) { "A2", "A3", "A4" }

Hi @BharathKamalapur ,

Ify required is available in the B2 cell i
Want cell index based on the index I will extract the AColoumn cell data.

If data is available in B3 cell output will be 3
If data is available on B6 cell output will be 6 like this I want
Based on the cell index value I will extract A3 or A6 cell data.

Output will in B coloum cell index


Use this in assign activity:

aCellData = (From row In yourDt.AsEnumerable()
             Where (row("B").ToString().Contains("PDF") AndAlso row("E").ToString().Contains("Billing")) OrElse
                   (row("B").ToString().Contains("PDF Note") AndAlso row("E").ToString().Contains("Billing"))
             Select row("A")).FirstOrDefault()

This query searches for a value in column “A” of a DataTable. It looks for rows where column “B” is either “PDF” or “PDF Note” and column “E” is “Billing”. If found, it retrieves the value in column “A,” or Nothing if no match is found.


resultVariable = (From row In YourDataTableVariable.AsEnumerable()
                  Where row.Field(Of String)("BColumn").Like("*PDF*Billing*") Or
                        row.Field(Of String)("BColumn").Like("*PDF*Non Billing*") Or
                        row.Field(Of String)("BColumn").Like("*PDF Note*Billing*")
                  Select row.Field(Of String)("ACell")).FirstOrDefault()

Hello @Baby123 please use this linq query instead:

InputDT.AsEnumerable.Where(Function(X) X("Logic").ToString.ToLower.Contains("pdf") AND X("Logic").ToString.ToLower.Contains("billing")).ToList().Select(Function(x) CInt(x(0).ToString)+1).ToList()

The output will be:

 List<int>(3) { 2, 3, 4 }

Hoping this helped you!!!

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