Sort DataTable based on column value




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):


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

How to sort a column (Price) from an excel file?

@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)
  2. Upath - Sort Datatable

Dominic :slight_smile:

Sort elements in a excel document and save it in a new sheet

please watch this