I would like to match the row in excel and delete the matching word row[UserName] in DataTable.
i have done as below but have some error. May help to guide me how to delete the DataTable Row by read the excel and delete the row in Data Table?
Hi @Yoichi , after i use IF condition, the export works but not filter the Username in exported excel file.
is the any() should make it as contain()? or need specific the column name in dtNTU data table? The any() will read all the Data Table data is it?
Hi @Yoichi Here is the file.
Mainly i do get the word from outlook body and export in excel file. now the excel file is working fine. additionally i want to add the matching to delete before export to excel file. I am figuring out how can make the deletion on the Data table level after the data capture in dtNTU Data Table. Export.zip (5.6 KB)
It may be user name in NTUdt contains extra white space because pattern is (?<=User Name: )(.*)
So, can you try to use the following pattern for user name?
Hi @Yoichi , also i need one more help. let say i have more sheet and more keyword to check. how i can add the [“UserName”],[Phone"] like that? or should i refer all in same sheet?
Hi @Yoichi , i have error when use AndAlso
so i use
& instead??
dtNTU.AsEnumerable().Where(r=>!arrDeleteForUserName.Any(s=>r[“UserName”].ToString().Contains(s)) & !arrDeleteForPhone.Any(s=>r[“Phone”].ToString().Contains(s))).ToArray()