admin管理员组文章数量:1186282
I was trying to implement an improved solution of the google script suggested here: Script to Change Row Color when a cell changes text.
However, after debugging my script, it occurred that my document is not accessible anymore. It seems that my script is erroneous and prevents my document from opening... The consequence is that I cannot disable/edit/remove the associated google script and I am stuck!
Do you have a way to solve this blocking issue?
UPDATE: After further investigations, it seems that the reason of the problem is due to an infinite loop script called from the event trigger onOpen()
. So my question can be reformulated to:
How do you stop a Google Apps script that gets into an infinite loop?
Can I use another script to kill the execution of this erroneous script ?
I was trying to implement an improved solution of the google script suggested here: Script to Change Row Color when a cell changes text.
However, after debugging my script, it occurred that my document is not accessible anymore. It seems that my script is erroneous and prevents my document from opening... The consequence is that I cannot disable/edit/remove the associated google script and I am stuck!
Do you have a way to solve this blocking issue?
UPDATE: After further investigations, it seems that the reason of the problem is due to an infinite loop script called from the event trigger onOpen()
. So my question can be reformulated to:
How do you stop a Google Apps script that gets into an infinite loop?
Can I use another script to kill the execution of this erroneous script ?
Share Improve this question edited Jul 16, 2022 at 16:02 Wicket 38.1k9 gold badges77 silver badges189 bronze badges asked Feb 15, 2013 at 10:40 fabien7474fabien7474 16.6k23 gold badges99 silver badges126 bronze badges 06 Answers
Reset to default 16This is an old post but just in case:
Go to your Google Apps Script project page, within the My Executions tab: https://script.google.com/home/executions.
Filter by status so you can find the running project. On the right you have the three dots menu where you can terminate the running project.
Actually it is very simple. In your script loop, set a global var. Then when you want to stop it, wire up a script to set global var to false to a button image for example. Like this:
var RUNLOOP = true;
function YourLoop() {
if (RUNLOOP) {
// your code that does something every loop
}
}
function stopLoop() {
RUNLOOP = false;
}
There is a limit of about 6 minutes beyond which a script will stop executing. This is applicable to functions run on a trigger. But it is definitely worth waiting 6 minutes with your spreadsheet open.
When you copy a spreadsheet, triggers created in the triggers menu are removed. Try making a copy of the offending spreadsheet and going from there.
If you have access to your browser history, use it to access just the code of your project.
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 remove it so that it will no longer work--this action will remove all the permissions given to the script.
I had the same question, and here is what I've been able to find:
The script will eventually time out after 6 minutes. At this time, you can only manually stop an actively running Google Apps Script from within the Script Editor, and even then, only if you kicked it off from within the Script Editor.
As a workaround, you can build in a "kill-switch" to your functions, but this might negatively impact performance and will require you to add logic to check the "kill switch" to every function you want to be able to stop.
Here is an example of such a "kill switch":
https://ctrlq.org/code/20112-suspend-google-script-execution
本文标签:
版权声明:本文标题:javascript - How to stop a google app script from an infinite loop always executed when opening the Google Spreadsheet document? 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1738282285a2072783.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论