LINQ query for value search

I am working on an excel sheet. I need to check if any cell of the sheet has value starting with “#”.

I am reading the entre sheet data in a data table.
Using for each data row will take too much time. Hence I am looking for LINQ query.

Please guide for the query.


Do you need True or False as a result? If so, the following will work.

dt.AsEnumerable.Any(Function(r) r.ItemArray.Any(Function(item) item.ToString.StartsWith("#")))

If there is cell which starts with “#”, the above returns True.


Thanks @Yoichi … The solution worked for me.

LINQ query are making my automations work faster. I am new to LINQ query. Can you suggest any site/book to learn from.

have a look here:

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