0

I have a google sheet that needs to auto sort by the timestamp whenever a user submits a form response. I found a script that will do this but it only works when I run the script manually. The script is:

function getSpreadSheet(){

  var ss = SpreadsheetApp.getActiveSpreadsheet();
  var sheet = ss.getSheetByName("New");
  sheet.sort(1, false);
}
Josh_S
  • 3
  • 1

1 Answers1

0

There are two types of Google Apps Script triggers. Simple triggers are those that are run based on the function name and are limited to onOpen(), onEdit(), onInstall(), and doGet() and doPost(). For an On Form Submit trigger, you need to make your function an Installable Trigger by choosing Edit->Current project's triggers. From there you want to get to click the link if there are no triggers and then select your function int he first drop down item, set the event to From spreadsheet and the next option to On form submit.

Karl_S
  • 3,364
  • 2
  • 19
  • 33
  • I created the installable trigger and am still having the same issues. The script works on other sheets that I have used it on but not this one. I think there might be some issues with the sheet itself – Josh_S Aug 18 '17 at 16:01
  • You would have to save a copy of your sheet by editing your original post for someone to troubleshoot if that is the case. Does the file have a sheet/tab named New? That seems to be the only thing that it could be based on the code you supplied. – Karl_S Aug 18 '17 at 19:04