How to search for a specific word from one excel to another excel and highlight that keyword

I want to search for a specific keyword and highlight that keyword. i am unable to find the keyword and highlight it. How do i highlight the keyword? Please help me to resolve the issue.

1 Like

is that keyword lies in any specific column
Cheers @sneha_arbole

@sneha_arbole,

Do you want to highlight the keyword alone or the whole cell where the keyword is available?

yes it lies in specific column,but i dont know the which column it lies i need to search it.

I want to highlight the keyword alone

Fine
Hope these steps would help you resolve this
—use a excel application scope and pass the file path as input
—inside the scope use read range activity and get the output with a variable of type datatable named dt
—now use a for each row activity and pass the variable dt as input
—inside the loop use a assign activity like this
str_colname = IF(row.ItemArray.ToList.IndexOf(“your keyword”) > 0, Convert.ToChar(row.ItemArray.ToList.IndexOf(“your keyword”)+65).ToString,String.Empty)

Where str_colname is a string variable with default value as string.empty

—then next to this use a IF condition like this
NOT String.IsNullOrEmpty(str_colname.ToString)

If true it will go to THEN apart where we can use a SET RANGE COLOR activity and mention the range as
str_colname+(dt.Rows.IndexOf(row)+2).ToString
And color as System.Drawing.Color.Red

Cheers @sneha_arbole

1 Like

**str_colname = IF(row.ItemArray.ToList.IndexOf(“your keyword”) > 0, Convert.ToChar(row.ItemArray.ToList.IndexOf(“your keyword”)+65).ToString,String.Empty)
I did not understand, why you taken 0 and 65. Can you please elaborate it,

@sneha_arbole,

In excel you can not highlight a word alone in a cell.

if there is no keyword in a row, it will give index as -1 so have set a condition should be more than 0
and if so it will get the index of the column and gets added with 65 because 65 ascii code is A
which is then added with row index +2 to find the cell position like A2 , or A3…like that

Cheers @sneha_arbole

1 Like

Thank You

1 Like

cheers @sneha_arbole

The key word is not getting highlighted…

Did that step included
@sneha_arbole

Yes i have included that step

Hi @sneha_arbole,

And also you can try the find activity to search the word inside excel.

Regards
Balamurugan.S

Need to search the keyword from one excel file to another.I Used lookup range activity but it is giving the output as a cell reference of that keyword.