How to stop a google script application from an infinite loop that always runs when a Google Spreadsheet document is opened?

I tried to implement the improved google script solution offered here: Google table: script to change the color of a row when a cell changes text; .

However, after debugging my script, it happened that my document is no longer available. It seems that my script is wrong and prevents the opening of my document ... The consequence is that I cannot disable / edit / delete the associated Google script, and I am stuck!

Do you have a way to solve this lock problem?

Thanks,

Fabien

UPDATE:. After further research, it seems that the cause of the problem is related to the endless script loop called from the onOpen () event trigger. Therefore, my question can be reformulated as follows:

How to stop a Google script application that gets into an infinite loop?

Is it possible to use another script to kill the execution of this erroneous script?

+3
source share
6 answers

The limit is about 6 minutes, after which the script will stop execution. This applies to functions that are triggered by a trigger. But it is definitely worth the wait 6 minutes with an open table.

+2
source

When copying a spreadsheet, the triggers created in the trigger menu are deleted. Try to make a copy of the violating table and from there.

If you have access to your browser history, use it to access only the code for your project.

+1
source

You can go to the following address:

https://security.google.com/settings/security/permissions

using the account on which the script is installed, find the script (using the name) and delete it so that it no longer works - this action will remove all permissions granted to the script.

+1
source

I had the same question, and here is what I managed to find:

The script will eventually expire after 6 minutes . Currently, you can manually stop the active Google Apps script from the script editor , and even then only if you release it from the script editor.

As a workaround, you can create a kill-switch for your functions, but this can negatively affect performance and require you to add logic to check the kill switch for every function that you want to stop.

Here is an example of such a "kill switch":
https://ctrlq.org/code/20112-suspend-google-script-execution

0
source

Actually it is very simple. In your script loop, set the global var. Then, when you want to stop it, include a script to set the global var to false for the button image, for example. Like this:

var RUNLOOP = true; function YourLoop() { if (RUNLOOP) { // your code that does something every loop } } function stopLoop() { RUNLOOP = false; } 
0
source

This is an old post, but just in case:

Go to the Google Apps Script project page on the My Solutions tab: https://script.google.com/home/executions .

Filter by status to find a running project. On the right, you have a menu with three dots in which you can complete an ongoing project.

0
source

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


All Articles