Search for a word and return as boolean

I want to search ‘SampleText’ word in excel and want to check this word exist or not

Hi @ajnaraya

isSampleTextFound= DataTable.AsEnumerable().Any(Function(row) row.ItemArray.Any(Function(cell) cell.ToString().Contains("SampleText")))

' Check if 'SampleText' was found
If isSampleTextFound Then
    ' 'SampleText' exists in the Excel file
    ' Perform actions as needed
Else
    ' 'SampleText' was not found in the Excel file
    ' Perform other actions if needed

@ajnaraya
.

booloutput=dt.AsEnumerable.any(function(x) x(“columnname”).tostring.equals(“Sample Test”))

Gives boolean output
In Columnname you need to pass which column you need to check

Cheers

Hi @ajnaraya

Check this below thread

Hope it helps!!

Hi,

Can you try as the following?

dt.AsEnumerable.Any(Function(r) r.ItemArray.Any(Function(o) o.ToString.Contains(keyword)))

Please note that it probably better to uncheck add header option in ReadRange activity.

Regards,

Hi @ajnaraya

You can use the simple Excel activities to check the word exist in excel.

→ Use the Excel Process scope activity and insert the Use excel file activity inside it.
→ Give the Excel Path in the Use excel activity.
→ Inside Use excel file activity, insert the Find\Replace Value activity and give the sheet name of excel in where to search field, select the Find option in Operation options, In Value to find give the Keyword with in double quotes and create a variable in the Found at field let call the variable name as FindValue.
→ After Use excel file activity insert the If condition to check the condition the value exist in the excel file.
→ Give the below condition to check the keyword exist or not.

FindValue IsNot Nothing

→ In then block give the activities to move forward when keyword exist.
→ In else block give the activities to move forward when keyword doesn’t exist.

Check the below image for better understanding.

Hope it helps!!