Column name not found and For Each using filter items

Hi,

I have a couple of questions on a current task:

1.Not sure why the excel column name is not being found in my assign activity

Column name is Username/Email

assign activity is
query = String.Format("Username/Email =‘{0}’ ", word)

query is of variable type String

The aim is to search under that column name and remove data rows

i’ve attached a copy of the error message

  1. I am using a for each to remove the data rows and would like to broaden the keyword search to use like

tom@test.co.uk
ray@mail.com

I only want to remove rows that have @test.co.uk in the Username/Email column

To achieve that i created a variable in my For Each called List with a default value of {“@test.co.uk”} to remove any user name like @test,co.uk
The List variable is of type an Array of System.String

Any help would be appreciated.

Thanks

@Supernova

Have you checked Add headers in properties of Read Range activity.

If i remove the /Email from the column name and use only username it finds it

Yes, that checked.

@Supernova

Try columnName like this: [Username/Email]. ColumnName is case sensitive.

My sample workflow attached

Upload - Forum Remove Data.zip (12.0 KB)

@Supernova

We can’t write select query like that. I changed code as per your need and find the same.

Upload - Forum Remove Data.zip (14.0 KB)

If you have any doubts then let me know and am ready to help you.

Thanks but I don’t want to create another worksheet, just need to remove them from the existing worksheet.

Tried using the Write range to the same worksheet “Master Data” but it faulted with the following message “System.Data.EvaluateException: Cannot perform ‘Like’ operation on System.Double and System.String.”

@Supernova

I created separate sheet because you tried to write final result in another sheet. That’s why I did like that.

If you don’t want to write in separate sheet then do one thing use Write Cell activity and specify range as “A1:C500” and pass values as empty string " " before writing into sheet using Write range activity.

Hi, could you update the workflow with the changes.

I’ve also used your suggestion in my For each

from
String.Format("Username/Email =‘{0}’ ", word)

to
String.Format("[Username/Email] = ‘{0}’ ", word)

and that seemed to work but for only the default value set in the variable

Thanks, appreciate the help.

This was a UiPath exercise from the old Knowledge Base. See excercise here

All I was trying to do was to modify the keyword search to use like

@Supernova

I guess we can’t write select query like that. Try select query like below:

Dt.Select(“[Username/Email] Like '”+word+“'”)

Please find the attached workflow for your reference.

Upload - Forum Remove Data.zip (14.3 KB)