Im trying to get AppleScript to sort the table and keep only the first 8 columns, the total number of columns often varies each use, as well as the column names.
This script gets it done but when there’s less columns it throws errors as it runs out of columns to remove when the amount of columns is less than the repeat amount.
Is there a way to tell it to select column 9 to the last column and remove the selection?
Or any better way of handling this?
tell application “Numbers”
tell document 1 to tell sheet 1 to tell table 1
sort by column 1 direction ascending
repeat 22 times
remove column 9
end repeat
end tell
end tell