Do the sorting column A(Account Number) – BM(Custom Data 34) – (recon report that we renamed) based on Column AQ (“Custom Data 12”)

Do the sorting column A(Account Number) – BM(Custom Data 34) – (recon report that we renamed) based on Column AQ (“Custom Data 12”)

scrrenshot i have attached can you please share me a code for this

Hi @swethareddy

Use below steps:

  1. Read Range (A:BM) → dt_ReconReport
  2. Sort Data Table
    • Column: "Custom Data 12" (AQ)
    • Order: Ascending/Descending as required
  3. Write Range back to Excel.

This will sort the entire range A (Account Number) to BM (Custom Data 34) based on AQ (Custom Data 12).

Happy Automation

Hi @swethareddy,

If you’re referring to sorting Excel rows by cell color in UiPath:

  • Excel activities do not currently support Sort by Color directly.
  • You have a few alternatives:
    1. Use VBA to sort by cell color.
    2. Use UI Automation to perform the Excel ribbon action

Thanks

Hi @swethareddy,

I assume sorting should just be done based on “AQ” (or “Custom Data 12”) column and not based on the color.

Here’s the logic for sorting:

  • Use “Excel Process Scope” (Modern Excel activities).
  • Use “Read Range” to read the data (Columns A:BM) into a DataTable, e.g., “dtRecon”.
  • Add a “Sort Data Table” activity on “dtRecon” DataTable.
    • Column: “Custom Data 12” (or “AQ” if there are no headers)
    • Order: Ascending or Descending as required.
  • Use “Write Range” to write the sorted DataTable back to the same sheet.

Cheers!