如何使用App脚本读取Google Form数据 [英] How to read Google Form Data Using App Script
本文介绍了如何使用App脚本读取Google Form数据的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我是App Script的新手.我正在尝试使用App Script读取提交的数据.我尝试使用此处提供的答案,但我看不懂.
I'm new to App Script. I'm trying to read the submitted data using App Script. I tried to use the answer provided here, but I'm not able to read it.
我尝试了许多其他方法,但它们也无法正常工作.
I tried many other method, they are also not working.
function myFunction() {
var form = FormApp.openById('1_HABIBYRZ-zsEMuzMCnsrAOYFlQSKwaIhmeT1y2SY6Y');
var formResponses = form.getResponses();
MailApp.sendEmail ("test@appirio.com", "Form Submited: Foo feedback " + Date.now(), +formResponses);
}
我还想知道如何调试App Script中的任何问题.
I also want to know, how to debug any issue in App Script.
预先感谢!
推荐答案
上面的其他答案可能有用,但是有点复杂.为了让您将表单响应保留为程序内的变量(可以通过电子邮件将其发送给您),您可以执行以下操作:
The other answer above may work, but it's a bit complicated. To let you keep the form responses as a variable inside your program, which would allow you to email it, you can do this:
function formResponsesToArray() {
var app = FormApp.openById(...),
responses = app.getResponses(), stringResponses = []
responses.forEach(function(r) {
var response = []
r.getItemResponses().forEach(function(i) {
response.push(i.getResponse())
})
stringResponses.push(response)
})
Logger.log(stringResponses)
}
这将记录以下一系列响应:
Which will log an array of responses like this:
这篇关于如何使用App脚本读取Google Form数据的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文