Take the 2-minute tour ×
Web Applications Stack Exchange is a question and answer site for power users of web applications. It's 100% free, no registration required.

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?

share|improve this question
    
You must use the on open function first, and call for the sort function. –  Jacob Jan Tuinstra Mar 13 '13 at 6:42
    
See following answer I gave: webapps.stackexchange.com/a/36352/29140 –  Jacob Jan Tuinstra Mar 13 '13 at 6:46
add comment

1 Answer

up vote 1 down vote accepted

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}]);
  }
}
share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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