How to filter values not equal to zero in excel

Hi All,

I have a requirement where in i need to input a filter in excel in the 8th row and get the values as not equal to zero in one of the columns. I am fairly new to UIPath and i tried this with Filter Table Activity, but that does not seem to work.

Appreciate any assistance in this regard.

@Prithvi_P_M

         filterDT = inputDT.Select("[columnname] < > ‘0’ ").CopyToDatatable()

Where inputDT is holds your input data.

1 Like

@Prithvi_P_M

In addition to what @lakshman said, you can use the below code :point_down:

Or use Filter Table Activity :point_down:

Remove

Column = “Column0” ; Operation = " < > " ; Value = “0”

1 Like

Hi Lakshman,

Thank you for the response. However I do not want to copy the same into a DataTable. I want to filter out these values in the same excel sheet.

@Prithvi_P_M

The above mentioned expression will give you required output. Then delete the data and write new filtered data.

@lakshman
I do not want to delete the other data as i need them for other checks and also other columns are formulated and deleting existing data and writing on top of that may not work. My bad I did not mention this in my initial query.

In addition to this i tried using the Filter Table activity and i am able to filter out values equal to 0 but when i use <0> under Filter options i get the error as Range not available

@Prithvi_P_M, I think you are on right track. You can use “Filter Table” activity. Just setup all properties carefully. You can refer following link to get better idea:

If it doesn’t work for you, please share how are you setting up Filter Table activity.

Cheers

1 Like

@Bhavik_Solanki

Thanks. This is what i have used under the “Filter Table” activity
For Filter Options when i use {“0”} it works absolutely fine and provides me the values which equals to 0. However when I try using {“<0>”} I do not get the values not equal to zero and I get an error stating “Range does not exist”
I have also tried {“<>‘0’”}, but of no use.

@Prithvi_P_M, I believe you cannot write syntax like that. FilterOptions parameter expects array of string (or variable type of string). Is there anyway you can provide values to be filter? Do you have data in DataTable by any chance?

1 Like

@Bhavik_Solanki. Thanks for your response. The columns i need the filter to be applied is a formulated one and the value i need is all values not equal to 0. I do not have the data in a DataTable but i think i can use a Read range and have the output in a DataTable. what do you suggest to go from there? or can you help me out in arriving at what syntax to be written in FilterOptions.
Please bear with me as i am new to UIPath and also from a Finance background.

@Prithvi_P_M, I tried multiple ways to work with FilterOption with no luck. So I think using Read Range Activity is better choice as workaround.

Hi Prithvi
You can use read range to read the Excel file and filter the rows using “Filter Datatable” activity. However, please bear in the mind that the data type of each column depends on the data type in your Excel file. The value zero can be value 0 or string “0”. You have to test which datatype is the correct one.