Filter excel on multiple columns

Hi All,

I have excel it has a Value =“True” and “False”. in Column E and F and G.

I want to filter only true values by using the coding. can you help me on this.

I used this, it filter only Column E while I try with multiple columns its through error.
Dt.Select(“Coulmn E=”&Value).CopyToDataTable

Notes: I have created Variable Value='True".

@Abudhahir

Try this:

              DT.Select("ColumnName = '"+Value.Tostring+"'").CopyToDataTable

Hi @Abudhahir

You can use Filter Data Table activity for that one.

Thanks and regards

2 Likes

Hi Brian,

I plan to use via coding.

1 Like

Oh okay :slight_smile:

2 Likes

Hi @Abudhahir

Try using the below code for multiple filtering

With variables
Dt.Select(“Coulmn E= '” + StringValue + "' AND ColumnName = '" + StringValue + "' ").CopyToDataTable

Without variables using hard coding
Dt.Select(“Coulmn E= 'True' AND ColumnName = 'False'").CopyToDataTable

Let me know whether it helps

3 Likes

Hi @Lahiru.Fernando,
when I try using the code with variables I got this error : Assign: Syntax error: Missing operand after ‘number’ operator.
Could you kindly help me?
Thank you

refer to this

1 Like