Search a value in Excel and Find duplicate column

Hi Everyone,

I need to search mouse ID value in Excel which I am getting from someother webpage. If mouse id exists then some flow and if it does not exists in excel then some other flow. Could you please give idea on this?



There are probably better solutions but what I would do would be a read range on all your Excel. This would generate a datatable.

Then I would use the for reach row activity on your datatable and then check in a if activity the condition “row(0).toString.equals(String.empty)”

(I chose 0 as the index cause it seems that the Mouse ID column in your screenshot is the first column of your excel)

This will check if the mouse ID for your current row exists or not.

Please tell me if this solution works for you.

PS : Rashmi’s answer is way better :slight_smile:

Kind regards,


1 Like

Hi @Boopathi

Execute the below code by Assignment activity, You can get the result in a single line.

 intMobileCount= internalSourceTable.Rows.Cast(Of DataRow)().Where(Function(a) a("MobileID").ToString() = "3453455").Count()


1 Like

@balupad14 Thank you very much. It works and I can take decision based on the count. Now I have an another challenge. two column names repeats in excel. I need to delete the second repeating column name. Macro cannot be used as i need to download the excel dynamically for every transactions.

Current Partner name (K column) and another column also Current Partner name (L) I want L column name to be deleted or renamed. Could you please let me know how can i achieve this?


@balupad14 Can we also apply this on a particular cell without using datatable

You can use Remove Data Column


With the following propreties


Hi @Boopathi,

You can use this code to fine last duplicated columindex.

 ColumnIndex = dt.Columns.Cast(Of DataColumn)().Select(Function(a) a.ColumnName).ToList().FindLastIndex(Function(a) a.StartsWith("Current Partner name")) 


1 Like

Thank you. It works

Hi Bala, all this code is VBA or .net ? How much important it is to learn this? Thanks in advance!

Hi @Deepak11,

Inside the UiPath studio , it supports only the developing the custom activities , it supports both and learning is an additional advantage. Thats Y , the Uipath and Uipath team have been released more activities to make easy to use end user without doing the coding. But if you face the technical problem. you can share it in the UiPath community form. And you can get help. I think , The UiPath community form is best form. Because you will get the response as sooner and better.


1 Like

Thanks Bala. So the below code is or

ColumnIndex = dt.Columns.Cast(Of DataColumn)().Select(Function(a) a.ColumnName).ToList().FindLastIndex(Function(a) a.StartsWith(“Current Partner name”))

Hi @Deepak11,

Yes it is code.



Thanks Bala. Your one line of code inspired me to learn this sure shot bullet. Could you please provide me a reference weblink or some doc to handle this.

You help is highly appreciable.

if I don’t kno windex then ?

if I don’t know index then ?