How to filter columns

hello everyBody,

please i need your help , i have an excel file with a lot of columns , the goals is to filter one or two … columns ?

and the second question is how to do a multiple filter in same column

big thanks !

  1. You can read the excel data into a datatable using Read Range activity. To put a filter, you can use datatable.Select Method i.e. dtInput.Select(“[col1] = ‘yourVal1’ AND [col2] = ‘yourVal2’”)

  2. You can put multiple conditions (filter) on the same column using the same “select” method. i.e. dtInput.Select(“[col1] = ‘yourVal1’ OR [col1] = ‘yourVal2’”)

Replace col1/col2 with your actual columns.

Please refer to this link for further info. https://www.uipath.com/kb-articles/how-to-filter-a-data-table

Let me know if this helps!

1 Like

Getting syntax error for this , could you give me one example?

Hi @nyusuf

Please provide more context :slight_smile: The basic syntax looks like this:

dtInput.Select("[col1] = 'yourVal1'")
dtInput.Select("[col1] = 'yourVal1' OR [col1] = 'yourVal2'")

Actually, first try the code formatted strings above. Text not formatted as code sometimes will give a wrong single quote.

The below will not work in UiPath (note the single quotes and how different they are to the ones above):

dtInput.Select("[col1] = ‘yourVal1’ OR [col1] = ‘yourVal2’")
2 Likes

Hello,

you can makro this and at Uipath use Activiti Execute makro.

1 Like