Failed to delete triggers (google-apps- script)

I seem to have triggers that I cannot delete in my Google Apps Script. I have a theory as to why I cannot remove them, but I don’t know how to fix the problem. These triggers were attached to a script attached to files in a separate Google account that were provided to me. Of course, I was able to edit and modify the script and, for example, I wanted while the files were shared. Since then, although the Google account that shared the files with me has been deleted, and I think that the triggers that are “frozen” are the remnants of these files from this account. Any suggestions to fix this problem?

A screen grab of my "frozen" triggers "

+4
source share
3 answers

Simple triggers cannot be removed from this 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]);
  }
}
+2
source

Have you tried logging in to your Google account, then select "Account Settings" and then "Account Permissions". You should be directed to a list that has all permissions (applications and scripts). You can find it there.

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

0
source

You can try to learn more about the document container script. You can check the URLs for editing and for users. If the document is not bound to a container, you can access the sharing information in the menu. If this is the last time you use a script, you can also copy the script and delete the original script - either manually or as a document. But take care of any dependencies such as script properties.

I wrote a short loop to record information about the Url container 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.");
  }
}
-1
source

Source: https://habr.com/ru/post/1569787/


All Articles