Created
February 1, 2014 14:43
-
-
Save adamcbrewer/8753190 to your computer and use it in GitHub Desktop.
GS: Automatically sorts the 1st column (not the header row) Ascending.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Automatically sorts the 1st column (not the header row) Ascending. | |
*/ | |
function onEdit(event){ | |
var sheet = event.source.getActiveSheet(); | |
var editedCell = sheet.getActiveCell(); | |
var columnToSortBy = 1; | |
var tableRange = "A4:Z99"; // What to sort. | |
if(editedCell.getColumn() == columnToSortBy){ | |
var range = sheet.getRange(tableRange); | |
range.sort( { column : columnToSortBy, ascending: false } ); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment