How to write status success in the cell hear am using LINQ

Hello, I have a Question

  1. I want a filter where status is null I want to read the data for Filtering I Use LINQ
  2. After that I want to update that row Sucess

Hear the problem is I can filter that data using LINQ (dt1.AsEnumerable.Where(Function(r) String.IsNullOrWhiteSpace(r("Status").ToString.Trim)).CopyToDataTable)

But how to Update that status success

Chethan P

Hi @copy_writes

Use invoke code with dt1 variable as In/Out
dt1.AsEnumerable.Where(Function(r) String.IsNullOrWhiteSpace(r(“Status”).ToString.Trim)).ToList().ForEach(Sub(row) row(“Status”) =“Success”)

Here i am updating status with Sucess for demnstration, but u can add status according to yours

After the invoke code, use write range to write the dt1 to the excel file

Nived N
Happy Automation


i get error like this

I got it Thank you very much
@NIVED_NAMBIAR And @Pradeep_Shiv please suggest to me how to learn LINQ and where I have to learn, Please
You have any tutorial please share me

Chethan P

Please Explain this code if you don’t mind

Chethan P

1 Like

Hi @copy_writes

It is actually converting the list of rows to a list and then using method in list to loop through each element of list and updating the fields.

Hope you got it


Nived N :robot:

Happy Automation :relaxed::relaxed:


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