Unable to delete triggers (google-apps-script)

前端 未结 3 1331
醉酒成梦
醉酒成梦 2021-01-06 05:33

I appear to have triggers that I cannot delete in my Google Apps Script. I have a theory as to WHY I cannot delete them, but no clue how to fix the problem. These triggers w

相关标签:
3条回答
  • 2021-01-06 05:49

    Have you tried going to your Google account, then choosing "Account Settings" and then "Account permissions". You should be directed to a list that has every permission (apps and scripts). You may be able to find it there.

    https://security.google.com/settings/security/permissions?pli=1

    0 讨论(0)
  • 2021-01-06 05:49

    You could try to find out more about the script's container document. You can check for edit URLs and for users. If the document was not bound to a container, you could access the sharing information from the menu. If you are the last person to use the script, you could also copy the script and delete the original script - manually or as a document. But take care of any dependencies like script properties.

    I wrote a short loop to log information about container Url and its viewers:

    function containerFinder() {
      if (DocumentApp.getActiveDocument()) { 
        var document = DocumentApp.getActiveDocument();
        var editUrl = document.getUrl();
        var editors = document.getViewers();
        Logger.log("This Script belongs to a document.");
        Logger.log("Edit Url: " + editUrl);
        Logger.log("Editors: " + editors);
      }
      else if (SpreadsheetApp.getActiveSpreadsheet()){
        var spreadsheet = SpreadsheetApp.getActiveSpreadsheet();
        var editUrl = spreadsheet.getUrl();
        var editors = spreadsheet.getEditors();
        Logger.log("This Script belongs to a spreadsheet.");
        Logger.log("Edit Url: " + editUrl);
        Logger.log("Editors: " + editors);
      }
      else if (FormApp.getActiveForm()){
        var form = FormApp.getActiveForm();
        var editUrl = form.getEditUrl();
        var editors = form.getEditors();
        Logger.log("This Script belongs to a form.");
        Logger.log("Edit Url: " + editUrl);
        Logger.log("Editors: " + editors);
      }
      else {
        Logger.log("This Script does not seem to belong to any container.");
      }
    }
    
    0 讨论(0)
  • 2021-01-06 06:06

    Simple triggers can not be deleted from that window: See Here

    Instead add this function to your script and run it:

    function deleteTriggers() {
      var allTriggers = ScriptApp.getProjectTriggers();
      for (var i = 0; i < allTriggers.length; i++) {
        ScriptApp.deleteTrigger(allTriggers[i]);
      }
    }
    
    0 讨论(0)
提交回复
热议问题