Off Topic: Need Help

Thread in 'Discussion' started by Corrosive, 16 Mar 2015.

  1. I've been developing a Hard Drop player ranking system and I am hitting a wall with getting my spreadsheet to automatically re-sort upon any edits or form submissions.


    Finished the submission form:
    https://docs.google.com/forms/d/1Ur...hfB4hQmKF4/viewform?fbzx=-5629054892607225297

    Prototype of the finished standings/spreadsheet:
    https://docs.google.com/spreadsheet...-Ric3ccrj4/pubhtml?gid=1900970047&single=true

    Everything is great except that the spreadsheet is not automatically sorting by the "Standing" column after each edit/form entry.

    I'm thinking a script may be necessary??? And here is what I've tried but I'm not even sure if I'm even incorporating/using it right

    /**
    * Automatically sorts the 1st column (not the header row) Descending.
    */
    function onEdit(){
    var sh = SpreadsheetApp.getActiveSpreadsheet().getActiveSheet();
    var editedCell = sh.getActiveRange().getColumnIndex();

    if(editedCell == 2) {
    var range = sh.getRange("G2:G500");
    range.sort({column: 2, ascending: false });
    }
    }
     
    Last edited: 17 Mar 2015
  2. If any of you think that you can straighten this out I'll give you any permissions you need.
     
  3. AFAIK there's already a new ranking system under development for the forum here, which is slightly more integrated than a Google spreadsheet.

    Not sure if what you're wanting to do is actually possible or there's a fundamental limitation of Google spreadsheets. You might be able to hack in some kind of work around by some sort of lookup function that will inherently update itself every time the data changes (and just set it to 100 rows or whatever maximum you might need). To be honest I don't really know shit about Google spreadsheet scripts - if it was Excel I'd probably be able to help but docs.com doesn't support macros.

    Also calm down with your triple posting, plenty of people in the US aren't even awake yet and us Europeans barely got home from work.
     

Share This Page