您如何在Google Forms中使用Logger.log(e)?(使用NEW Apps脚本编辑器) [英] How do you use Logger.log(e) with Google Forms? (Using the NEW Apps Script Editor)

查看:96
本文介绍了您如何在Google Forms中使用Logger.log(e)?(使用NEW Apps脚本编辑器)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在旧版Apps脚本编辑器中,您可以从Google表单提交中登录e.如何在NEW Apps脚本编辑器中完成此操作?

In the legacy Apps Script Editor you could log e from Google Form submissions. How is this done in the NEW Apps Script Editor?

function myFunction(e) {
  Logger.log(e);
}

推荐答案

要确保我们在同一页面上:

如果您要在任何编辑器中运行这样的功能,您将获得 null :

To make sure we are on the same page:

If you are going to run a function like this in any editor you are going to get null:

因为未简单定义 e ,并且仅在执行此函数时才返回数据.但是此功能由某些事件执行,具体取决于您使用的触发器的类型.因此,如果您手动执行此功能,您将不会在控制台中看到任何内容(不是 null ).

because simply e is not defined and it is only returning data upon trigger executions of this function. But this function is executed by some events depending on the type of trigger you are using. Therefore, you are not going to see anything (that is not null) in the console if you manually execute this function.

再次在任何编辑器中,您都可以转到执行页面以查看执行的详细信息.在新的编辑器中,您转到执行:

In any editor again, you can go to the execution page to see the details of the execution. In the new editor, you go to Executions:

,您将看到此特定函数的所有执行的列表.例如,如果您的函数是简单的 onEdit 触发器,例如 onEdit(e),您在编辑电子表格中的单元格时会看到以下内容:

and you can see a list of all the executions of this particular function. For example, if your function is a simple onEdit trigger e.g. onEdit(e), you will see this upon editing a cell in the spreadsheet:

您还可以查看执行的类型,无论是通过脚本(编辑器)还是通过触发器(简单触发器)执行的.

You can also see the type of the execution, whether it was executed by the script (Editor) or by a trigger (Simple Trigger).

但是无论如何,触发器功能不应该手动执行.顾名思义,触发功能是在事件触发时触发的.使用触发函数并需要手动执行它是没有意义的.那将是一个常规功能.

But anyway, trigger functions are not supposed to be executed manually. As the name suggests, trigger functions are triggered upon events. It wouldn't make sense to use a trigger function and need to manually execute it. It would be a regular function then.

这篇关于您如何在Google Forms中使用Logger.log(e)?(使用NEW Apps脚本编辑器)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆