Sort DataTable based on column value

Hi,

I have an Excel looking like this:

Column1, Column2, Column3
XX, XX, -1040
XX, XX, -104
XX, XX, -1072
XX, XX, -1087
XX, XX, -111

I want to read this and sort the DataTable based on valuesd in “Column3”. This is the result using when using DataView.Sort(ascending):

-104
-1040
-1072
-1087
-111

This is of course not the result im looking for. Does anyone have any idea how i can do this sorting?

2 Likes

@Johan_Lundstrom, Use this query,

Assign activity

datatable dt =(From row In dt2.Select Order By Convert.ToInt32(row("Column1")) Select row).ToArray.CopyToDatatable()

Many More References

  1. Re order data table and writting Excel (simple questions) - #4 by arivu96
  2. Uipath - Sort Datatable - #2 by alex.stoian

Regards,
Dominic :slight_smile:

4 Likes

please watch this