Hi Devs,
Can someone help me to sort the excel column value from Z to A order.
Thanks & Regards,
Riya
Hi Devs,
Can someone help me to sort the excel column value from Z to A order.
Thanks & Regards,
Riya
dt = dt.AsEnumerable().OrderByDescending(Function(row) row(“ColumnName”).ToString()).CopyToDataTable()
Hey @Riya1 you can follow these screenshot to solve your query…
input example
Hi @Riya1
=> Use Read Range Workbook to read the excel and store the data in datatable say dt
.
=> Use the below LINQ Sxpression to sort an particular column from Z to A
dt = dt.AsEnumerable().OrderByDescending(Function(row) row.Field(Of String)("ColumnName")).CopyToDataTable()
=> Use Write Range Workbook to write dt
back to the excel.
Regards