How to get a specific row

Basically, I’m working on something and I need to get a specific row of the excel file if the “Reminder Date” column matches the current date of the world. I got the part of matching the reminder date to the current date but how do I extract the whole row? That’s my question :slight_smile: Please help me thanks!

@tarzantri

Try the below query to get the entire row. It will returns first matching row if more than one match found.

datarow_object = (from x as datarow in yourDatatable where convert.ToDateTime(x("column name")).ToString.Equals(yourDate) select x).first

Regards,
Ranjith.

1 Like

I tried it but I keep getting this message and when I insert “Reminder Date” into the Column Name, it says it doesnt exist when it does :confused:

@tarzantri

Can you tell me what is the source of your datatable “dt1”. Are you getting dt1 from excel sheet directly or by web scraping ? .

Instead of using column name try with column index row(column index) Eg. row(0)

If possible share your excel file and also CurrentDataarr[0] value here.

Regards,
Ranjith.

1 Like

I am using an excel sheet directly.
I tried it but it still can’t work for me
what do you mean by CurrentDataarr[0]? and here’s my excel sheet
HR.xlsx (12.3 KB)

@tarzantri
CurrentDataarr(0) you have used this value to compare in the query.

Well the problem is the first row in your excel sheet. So can you please read data from the range A2 with Add Header property enabled.

1 Like

Process.xaml (24.4 KB)

Well, the same error keeps popping despite the changes, can you take a look at my process file? I’m really confused :confused: thanks alot for helping me :slight_smile:

@tarzantri

Its working for me . please check this xaml Process.xaml (10.5 KB)

Issue in your code.

  1. You have given the index value with quotes surrounded Eg row(“8”) . Column index should be without quotes Eg row(8).

  2. Try to display the both values before comparing , since you are comparing only after converting date variable into string.

Regards,
Ranjith.

Thanks man it works now! you helped me a lot :smiley:

1 Like