Comparing two columns in Excel sheet but not rowwise

Hi Dominic,

The query which you gave me it ran thanks a lot for this but one query didnt ran as i expected i am pasting you that query
Datatable dtSingle = (From sheet1 In dtSheet1.Select
Where (From sheet2 In dtSheet2.Select
Where sheet1(“Debit”).ToString.Equals(sheet2(“Credit”).ToString) Select sheet2).Count =1
Select sheet1).CopyToDatatable()
I have total of 481 rows in sheet1 that is 481 rows in debit column and around 10995 rows under credit in sheet2 but after running the query and doing write range of dtsingle its pasting around 10995 rows but i hvae 481 debit rows.

Hi Dominic,

Its Working thanks a lot. I re-ran the query it worked nicely but truely speaking you are a genius.
Can you please let me know from where i can understand this query because although it worked but i was not able to understand the above query please suggest some site where i can go and understand this query.
Thanks for everything.

Hi Priyanka,

Thanks a lot for your help, you are always very hardworking and helpful.
and last thing priyanka can you please suggest me from where should i study to understand that query which Dominic has written. Any site somewhere if i study then i should understand that query because this query can help me in future for many things.
Thanks again in Advance.

I will search and will let you know.
Thanks for the humble words aamir :slight_smile:

Hi Dominic,

Just a small help in the previous scenario where from sheet1 debit column we were checking credit column if that credit contains only one exact match then we are copying all the rows of all the column from sheet1 and sending it at one place. i also want sheet2 matching rows all column what will be the query and also those rows which is not matching or matching is more than one count. i will send these two in different sheets as Ledger Reconcile and Ledger Unreconsile.
Thank you

@aamir, Made a small change (Bold Letters)

dtSheet1 - your sheet1
dtSheet2 - your sheet2

In Assign

Datatable dtLedgerSingle = (From sheet2 In dtSheet2.Select
Where (From sheet1 In dtSheet1.Select
Where sheet2(“Credit”).ToString.Equals(sheet1(“Debit”).ToString) Select sheet1).Count =1
Select sheet2).CopyToDatatable()

Datatable dtLedgerZeroOrMultiple = (From sheet2 In dtSheet2.Select
Where (From sheet1 In dtSheet1.Select
Where sheet2(“Credit”).ToString.Equals(sheet1(“Debit”).ToString) Select sheet1).Count <>1
Select sheet2).CopyToDatatable()

Dominic :slight_smile:

1 Like

Thank you so much Dominic for your help. is this query called linq query??
Because i searched a lot for this query in google exactly what it is and till now what i thin k it is a linq query. In the meanwhile let me adjust this query in my code and will let you know. Thanks once again for helping me.


YES exactly !


Welcome :slight_smile:

Dominic :slight_smile:

Thank you so much for your help . now i think i need to learn C# for understanding linq.


Opt for VB.NET as UiPath supports it, not C#

Dominic :slight_smile:

okay thanks any site you suggest which will be good for me for beginners to start studyng i know java but i dont have any idea reafrding

@aamir, Follow and refer these ,

  1. Uipath forum posts (previous) regarding Linq Query (Most helpful and concise)
  2. Microsoft MSDN site for Linqs

Dominic :slight_smile:

Thank you so much Dominic i will go through it. Thanks a lot for everything.

Hi Dominic,

Need your help.
I have an excel sheet in date column value is missing in between many times.
I want to fill those rows in date column. attaching you the excel sheet for reference.GL.xls (1.9 MB)
I have uploaded the dummy excel sheet. Please take a look into it

if u completed can you share this task xmal files or upload here

Hi @Dominic,

Will this scan the sheet row by row? Or will it copy and paste all the rows that match at once?
I am looking for something similar, but the spreadsheet has about 20k records, so I do not want a row by row solution. Appreciate your help! Thanks

Hi @oshinkavdia, it’s a LINQ - method of applying a query on a datatable that has been read from excel. So it queries’ directly on the datatable instead of looping row wise. This is faster when compared to traditional for each row.


I have a query.I have to compare Account Numbers in two sheets of excel and update in the “status” column.
but,in my case it should compare single row by row(It shouldn’t compare all rows at a time).please,help me with this.

Hi @Srilatha

Please refer this thread

Process rows in excel and write output - #29 by rahatadi

Let me know if you need any help