Assign Activity LINQ Query

I have an Excel sheet with almost 40000 Rows in it,

I am trying to read the Excel Sheet and using an assign activity I am trying to filter out rows like this

(From r In dt.Select()
Where Convert.ToDouble(r(“Rem Life(%)”).ToString)>70 Select r).CopyToDataTable

But I am getting an Error as :


My Flow :


Does anybody have an idea what might be the issue ?

Hi @Ishan_Shelke

Could you give this a try?

(From r In dt.AsEnumerable()
Where Convert.ToDouble(r("Rem Life(%)").ToString)>70 Select r).CopyToDataTable()

Kind Regards,
Ashwin A.K

Hi Ashwin,


Still the Error is same.

its about the value that is not parseable into a double by default. This can have multiple reasons e.g. local number format like
1.234,45 vs. 1,234.45

Just share with us some sample data of the datatable e.g screenshot from immediate panel

Hi @Ishan_Shelke ,

Maybe as a First try to also include .Trim on your .ToString and Check if it works.

If the above change doesn’t work then you could try the below :

DT.AsEnumerable.Where(Function(r)if(r("Rem Life(%)").ToString.Trim.IsNumeric,CDbl(r("Rem Life(%)").ToString.Trim)>70,false)).CopyToDatatable

Also, Check on the following for Errors on Directly converting to Datatable

1 Like

HI @Ishan_Shelke

For me it’s working. Can you provide us the sample input?


Just have this whole excel file, I am facing problem with this excel file

ATP stock report 19.09.2022.xlsx (5.9 MB)

same as described here:
:ambulance: :sos: [FirstAid] Datatable: Debug & Analysis invalid DateTime Strings / String to DateTime Parsing Issues - News / Tutorials - UiPath Community Forum

We cannot rely on what we do see visually in Excel. So the datatable has to be inspected

similar we can run an analysis in the immediate panel like

dtData.AsEnumerable.Where(Function (x) Not Double.TryParse(x(“Rem Life(%)”).ToString, nothing)).ToList

or others analysis lines

So we recommend to do this analysis as in less then 1 min the issues can be more analysed on the real causing values

Hi @Ishan_Shelke

You can try with Filter Data Table activity

Check out the XAML file

LINQFilter70.xaml (6.2 KB)


The To Trim command worked flawless Thanks

1 Like

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.