Ryan Giggey
Ryan Giggey

Reputation: 1

Auto Sort Function in Google Sheets

I'm looking to get items in my to-do lists on this spreadsheet automatically sorted based on priority # (1 at the top, and so on) but I want it to automatically sort each time it is edited. Is this possible with the sort function? Thanks for your help in advance!

https://docs.google.com/spreadsheets/d/1KHqe8Kvz0e-pbEnoVN6f6vyIyA7VNtuTSQn40q1qGD8/edit?usp=sharing

Upvotes: 0

Views: 2948

Answers (1)

player0
player0

Reputation: 1

it's not. you will need a script which will do exactly what you request. for example:

var ss = SpreadsheetApp.getActiveSpreadsheet();
var sheet = ss.getSheetByName("Sheet1");             // SHEET NAME
var range = sheet.getRange("A2:Z");                  // RANGE TO SORT

function onEdit(e)  {
  range.sort([{column: 2, ascending: true}]);        // COLUMN NUMBER TO SORT
}                                                    // TRUE/FALSE FOR ASCENDING/DESCENDING

_________________________________________________________

0

0

Upvotes: 1

Related Questions