Restore a Google Apps Script deleted for mistake - google-apps-script

I have wrote a Apps Script for my Google Sheet.
I activate some triggers to schedule some functions.
I add a bad trigger and I want to delete IT, I clicked on ALL Triggers page :
https://script.google.com/home/triggers
and inadvertently I have cliked on the name of project on the list of triggers.
Then I have clicked on the trash sure to delete the trigger but It delete my Project !!!
Possible that the trash page is empty and I have lost all my project with a click ?
https://script.google.com/home/trash

When deleting a project you get an alert adverting you of it.
As mentioned on it, if you have deleted the file, is gone forever.

Related

How to remove "other user" installable trigger?

Is there anyway to delete "other user" installable triggers? Being lucky enough to guess which user to delete only shows their trigger as disabled but still requires you log in their gmail to delete it which is kind of concerning when you are the "owner" of the spreadsheet?
You can't delete other user's trigger. A trigger to a script is associated with a user's Google account (and the script project).
What they do with their trigger is their own business. As the owner, you can decide if a user has the privilege to edit/view your spreadsheet. If a user has been provided with edit access, He can choose to use that privilege any way he sees fit. For example, He can choose to respond to any edit made to the sheet manually or programmatically through a script at his disposal.
If you want to know who made a particular edit, you can see the edit history of each cell.
There is no way to remove other users triggers.
Triggers are associated with the Apps Script project, not to the Spreadsheet file.
Users are able to create Apps Script Projects on any spreadsheets they have Edit access to.
If you do not want users creating Apps Script Projects on your spreadsheets, give them Read-Only Access.
The spreadsheets that already have other users triggers on them can only be "purged" by removing access.
You can permanently delete a script with all of its installable triggers after making a clean copy of it.
Go to the Overview section in the new Apps Script editor.
Click the 'Make a copy' button.
A new browser tab will be created with the new script on screen, then click the 'Delete project' button in the old script.
You can now add the triggers you need manually or by code.

How can I delete a project execution into Google script

I don't find any option or button for deleting one or more execution of a Google Script. It is possible ?
I want to purge all my developpemet exécution.
You may refer with this thread. Make sure that you are the owner of the spreadsheet to show the Delete Project... option under File menu..

Google Apps Script keeps running after trigger removed (multiple users)

I have a fairly simple Google Apps Script that runs every time an answer to a Google Form is submitted (by using "on form submit" trigger). The script does some simple manipulations and updates a Google SpreadSheet. Recently I needed to change that script to run manually and not on form submit, so I deleted the trigger. However the script still kept running on every form submit!
There are other users who might have the same trigger setup, since the spreadsheet and the code are shared. Is there a way to completely delete all the triggers for a particular script? In the meantime I just renamed the script and that has solved the issue, however this is a bad solution.
Search on stackoverflow did nothing, seemingly similar questions are resolved through clearing "Resources -> All your triggers...", which only does it for your user. Question is how to remove/edit all the triggers for the project, even from other users.
Here's how to stop any orphaned Google Script.
Go to https://security.google.com/settings/security/permissions
Click the script / project name you wish to uninstall
Next click Remove and you are done.

How to Stop Orphaned Triggers

Interesting use case:
1. Script 1 with ScriptApp trigger management associated as an image link in a Google Site
2. Created a new instance of the script under a new account and update the image link
3. Deleted the container script 1 within the Google Site
4. A user visited the Google Site to invoke the script, but the page was cached pointing to the previous script 1.
5. The on-error trap emails are being emailed to me every time the "deleted" script runs.
How do I delete or stop these triggers?
If you know the user that installed the trigger you could ask them to do to the "All my triggers" menu item in the script editor, find the trigger and delete it.
In the on-error email, there is a link to manage triggers. Make sure that the triggers are really gone. I had this issue with a set of shared spreadsheets, where I thought I had removed all the triggers, but my partner still had some enabled.
In the Script Editor, You can also check for a project's triggers programmatically, then work with that trigger and it's source:
// Get triggers
var triggers = ScriptApp.getProjectTriggers();
// Loop through each trigger
triggers.forEach(function(trigger) {
// Get the id
var id = trigger.getTriggerSourceId();
// You can then use that id to get the related form or a sheet. E.g. :
var ss = SpreadSheetApp.openById(id);
// You can also work with the trigger (i.e. delete it)
ScriptApp.deleteTrigger(trigger);
});
See https://developers.google.com/apps-script/reference/script/script-app for more

Deleted script, no triggers, still getting emails

I deleted a google apps script from docs (Gmail Snooze), but I keep getting a message every day:
Start Function Error Message Trigger
6/9/12 12:49 AM myFunction We're sorry, a server error time-based
occurred. Please wait a
bit and try again.
I've already tried creating a new script, going to Resources > All Your Triggers, and nothing is there.
Is there a better way to get rid of these error messages than creating a new filter in gmail to auto delete them?
Have you also tried deleting the spreadsheet from the Trash in Google Docs?
There have been some reported problems around deleting triggers. You may want to add a comment on this open issue.
This worked for me!
Open a spreadsheet then go to tools-spreadsheet editor, then on the
editor window go to Resources->All your triggers... and see if the
trigger is still listed there. If so, delete it.
Source: How to delete a google apps script service
There might be an update to the interface. Triggers are now accessible trough different menu.
Open script.google.com and open any project or create a new one if you don't have any projects. Then go to Edit>All your triggers and switch off the ones you don't need.