Sort Specific Column in Apple Numbers

@gglick scripted selecting a column here:

How can this be extended to then sort the selected column?

The sort command seems to only exist within a dropdown menu
sort menu

I tried editing @gglick's script by looking into Number's dictionary but it seems the sort commands are for rows and not columns.

I then tried @DanThomas UI Browser to GUI script but again was stopped by my lack of scripting skills.

# Auth: Christopher Stone
# dCre: 2021/07/18 13:02
# dMod: 2021/07/18 13:02 
# Appl: Numbers
# Task: Sort Table 1 of Active Sheet by Column Number.
# Libs: None
# Osax: None
# Tags: @Applescript, @Script, @Numbers, @Sort, @Column, @Table

tell application "Numbers"
   tell front document
      tell active sheet
         tell table 1
            sort by column 2 direction ascending
         end tell
      end tell
   end tell
end tell


Thank you. It looks so easy afterwards.

1 Like