简体   繁体   English

如何在本地调试 Google Apps 脚本?

[英]How to locally debug Google apps script?

I use clasp with VS Code to locally developing of Google Apps Script.我使用 VS Code 的 clasp 来本地开发 Google Apps 脚本。 It's too hard to use default code debugger.使用默认代码调试器太难了。 So I'm looking for some way to debug code locally.所以我正在寻找一些在本地调试代码的方法。 Any suggestions how can I do this?有什么建议我该怎么做?

The short answer is there is no way to debug it as you would do in the editor .简短的回答是没有办法像在编辑器中那样调试它

You can try to make workaround creating testing suites, or introducing various logs.您可以尝试解决创建测试套件或引入各种日志的方法。 But you cannot go step by step, inspecting variables as you would do normally.但是您不能像往常一样一步一步地检查变量。

Reference参考

It's not the best, but I'm inserting这不是最好的,但我正在插入

SpreadsheetApp.getUi().prompt(varNeededToCheck);

If it's not the value you are expecting you can cancel the script or you can press OK to continue.如果它不是您期望的值,您可以取消脚本,或者您可以按 OK 继续。 It's a workaround and how I'm doing it.这是一种解决方法,我是如何做到的。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 如何调试 Google Apps 脚本(也就是 Logger.log 记录到哪里?) - How to debug Google Apps Script (aka where does Logger.log log to?) 调试 Google Apps 脚本 Web 应用程序的有效方法 - Effective way to debug a Google Apps Script Web App 如何在Google脚本中调试电子表格自定义功能? - How to debug a spreadsheet custom function in google script? 如何在 Google Application Script 中调试 web 开发? - How to debug web development in Google Application Script? Google Apps 脚本 JSON.Parse 在调试时导致“无法连接到服务器” - Google Apps Script JSON.Parse causing 'could not connect to server' on debug 为什么 Google Apps 脚本中的 Try / Catch 会在调试模式下停止代码执行? - Why does Try / Catch in Google Apps Script stop code execution in debug mode? 如何解决 Google Apps 脚本开发中的常见错误 - How to solve common errors in Google Apps Script development 如何将参数传递给Google Apps脚本调试器? - How do you pass an argument to the Google Apps Script debugger? 如何调试在谷歌应用脚本中不相等的相同字符串? - How to debug identical strings that do not equal in google app script? 提示无法在Google Apps脚本中运行 - Prompt not working in google apps script
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM