r/GoogleAppsScript • u/Kitty_pumpkin3 • Jun 12 '26
Unresolved Auto-sort Script?
I am hoping to get some help with creating a script that auto-sorts a Google Sheet document! This is a passion project for me, and I have zero experience in this area. So I have 5 columns in use A-F, and Row 1 is frozen as they are headers. Column A is being used for names, and I am hoping to sort the names alphabetically. However, I don't want the name to be separated from the information I put in the other columns in the same row, if that makes sense. I will be forever grateful for any help!! :)
P.S. I have already tried this script with an "on edit" trigger, and it didn't work:
function sortAColumn() {
SpreadsheetApp-getActiveSpreadsheet) . getSheetByName ("Sheet1"). sort (1,false)
}
I got this error when I tried to run it:
TypeError: Cannot read properties of null (reading 'sort')
sortAColumn
@ Code.gs:2
View all comments
Show parent comment
1
u/Kitty_pumpkin3 Jun 12 '26
Thank you so much for your reply!! What if I want the range to be the entire row? How would I implement that into the script?