Google表格onEdit(e)TypeError:无法读取属性 [英] Google Sheets onEdit(e) TypeError: cannot read property

查看:76
本文介绍了Google表格onEdit(e)TypeError:无法读取属性的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试实现Google表格的onEdit(e)简单触发器.每当我尝试执行一个简单的函数时,例如:

I'm trying to implement the onEdit(e) simple trigger of Google Sheets. Everytime I try execute even a simple function such as:

function onEdit(e){
  Logger.log(e.oldValue);
}

我收到以下错误:

我的步骤:

我尝试了以下两个视频,但均未成功:

I've tried following these two videos with no success:

https://www.youtube.com/watch?v=eWn_JxPSbds

https://www.youtube.com/watch?v=L1_nIhiVc5M

解决方案

感谢@JPV和@TheMaster提供两种可能的解决方案:

Thanks to @JPV and @TheMaster for the two potential solutions:

我正在查看日志",而不是"Stackdriver Logging".

I was viewing the "Logs" and not the "Stackdriver Logging".

似乎您需要禁用V8才能在日志中查看它,但是需要Stackdriver Logging才能使用V8进行查看.

It seems you need to disable the V8 to view it in Logs, but need the Stackdriver Logging to view it with V8.

至少我看来是这样

编辑两次

以下是解决该问题的文档:

Here's the documentation where the issue is addressed:

https://developers.google.com/apps-script /guides/v8-runtime#ui_changes_for_logging

如果您的脚本使用Rhino运行时,则在Apps脚本编辑器中选择查看">日志"只会向您显示由Logger服务编写的最新日志.您必须选择查看">"Stackdriver Logging"才能查看使用控制台类编写的日志."

"If your script uses the Rhino runtime, selecting View > Logs in the Apps Script editor only shows you recent logs written by the Logger service. You must select View > Stackdriver Logging to see logs written with the console class."

推荐答案

V8没问题.该错误是因为您之前通过单击运行"按钮直接运行了脚本.那导致了错误并被记录.编辑时,将其记录为view> stackdriver记录.但是向您显示了先前的错误.您正在查看旧日志.

Nothing is wrong with V8. That error is because you ran the script directly by clicking run button before. That caused the error and was logged. When you edit, it is logged to view>stackdriver logging. But the previous error is shown to you. You're looking at old logs.

根据官方文档

对于使用V8运行时的脚本,脚本编辑器的视图">日志"菜单项同时显示当前会话

视图">日志"仅提供当前会话日志.要访问先前的会话日志或未通过直接在当前会话中运行功能而记录的日志,请使用视图">"Stackdriver Logging" ....

Only current session logs is available to View>Logs. To access previous session logs or logs logged not by running a function directly in the current session, use View > Stackdriver Logging ....

这篇关于Google表格onEdit(e)TypeError:无法读取属性的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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