小编use*_*294的帖子

如何让onFormSubmit自动触发?

您提供的"修复"(test_onformsubmit)代码,每次电子表格中有新数据时,我都必须手动运行它.我希望它在提交表单时自动将pdf发送到电子邮件.有办法吗?因为手动方式运行代码完全像它应该的那样,但我希望这是一个自动事件,所以我不需要做任何事情.

查看原始问题/问题的父线程

google-sheets google-apps-script

13
推荐指数
1
解决办法
3万
查看次数

在onFormSubmit触发器中获取TypeError?

我使用Google表单教程调整表单数据以合并为PDF,然后发送到电子邮件.我尝试运行脚本时收到以下错误消息:

TypeError:无法从undefined中读取属性"values".(第11行,文件"代码")

我不知道如何解决这个问题.我在网上搜索了一个答案.这是脚本的副本.我标记了脚本出错的2行:

var docTemplate = "1ZSqmId2BBjtz6PmgQEmusjnkHGsFKD1CBSq0rrQk6Kc";  
var docName     = "TestCertificate";

// When Form Gets submitted

function onFormSubmit(e) {

//Get information from form and set our variables 

var email_address = "EMAIL@example.com";

//**(THIS IS WHERE THE ERROR IS OCCURRING ON THESE 2 LINES BELOW!)**

var full_name = e.values[2];
var Activity = e.values[3];

// Get document template, copy it as a new temp doc, and save the Doc’s id

var copyId = DocsList.getFileById(docTemplate)
.makeCopy(docName+' for '+full_name)
.getId();

// Open the temporary document …
Run Code Online (Sandbox Code Playgroud)

google-sheets google-apps-script

4
推荐指数
1
解决办法
8467
查看次数

标签 统计

google-apps-script ×2

google-sheets ×2