I created an onEdit script which re-sorts a Google Spreadsheet every time a cell is edited.

The Google Spreadsheet is shared amongst multiple users and I'd like the script to run for all users, every time the spreadsheet is opened.

How do I set this up?


1 Answer 1


It turned out that a bug in my script was stopping it from running. For anyone who stumbles across this question trying to solve a similar problem here is my working script:

function onEdit(event){
  var sheet = event.source.getActiveSheet();
  var editedCell = sheet.getActiveCell();

  var tableRange = "A2:F999";

  if(editedCell.getColumn() == 6){   
    var range = sheet.getRange(tableRange);
    range.sort([{column: 6}, {column: 4}, {column: 5}]);

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.