How to search for specific string without using column name in whole excel sheet


#1

Search for a specific string in excel sheet without mentioning column name.


#2

Hi @MahalingPatil,

Use Output data table to get a string value and can check the string. Contains method.
Else
Use linq method to check the value is exists or not.

Regards,
Arivu:-)


#3

@MahalingPatil, Use this query, to get it as a Boolean, (whether that string exists or not)

Boolean b = (From row in datatable.Select() Where String.Join("", row.ItemArray()).Contains(string) Select row).ToArray().Count > 0

Regards,
Dominic :slight_smile:


#4

@Dominic, @MahalingPatil

you can also try like this. no need to use join

Boolean b = (From row in datatable.Select() Where row.ItemArray().Contaains(string) Select row).ToArray().Count > 0

Regards,
Mahesh


#5

Thank you…its working for me


#6

Convert output of excel to Output data table. And simply use “Contains” method.

if(Readable_Data.Contains(“text to compare”))
It will return true or false.