How to sort specific excel column

Hi Devs,

Can someone help me to sort the excel column value from Z to A order.

Thanks & Regards,
Riya

@Riya1,

If you are using Excel Process Scope use Sort Range activity.

Thanks,
Ashok :slight_smile:

dt = dt.AsEnumerable().OrderByDescending(Function(row) row(“ColumnName”).ToString()).CopyToDataTable()

Hey @Riya1 you can follow these screenshot to solve your query…
input example


cheers Happy Automation…

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