【问题标题】:how to create a google form response with app script如何使用应用脚本创建谷歌表单响应
【发布时间】:2016-08-18 07:58:23
【问题描述】:

作为初始化表单记录的一种方式,我想用应用程序脚本填写并提交一个谷歌表单。 form.createResponse() 文档的关键是这个

创建对表单的新响应。要回答问题项,请创建 来自项目的 ItemResponse,然后通过以下方式将其附加到此表单响应 调用 FormResponse.withItemResponse(response)。保存组装好的 响应,调用 FormResponse.submit()。

我需要 new FormResponse() 还是如何实现?

【问题讨论】:

    标签: google-apps-script google-forms


    【解决方案1】:

    创建新表单

        var test_form = FormApp.create('test1');
        test_form.addTextItem();
    

    将第一个问题作为文本项获取

        var questions = test_form.getItems();
        var qt = questions[0].asTextItem();
    

    设置响应

        var qr = qt.createResponse('cats');
    

    创建并提交响应对象

        var FormResponse = test_form.createResponse();
        FormResponse.withItemResponse( qr );
        FormResponse.submit();
    

    【讨论】:

    • 有两种不同的createResponse() 方法。完全相同的名称,但用于两个不同的事物。一个用于项目,带有参数的答案将是:Apps Script documentation 另一个没有参数,用于表单以创建整体响应。 new response to the form
    猜你喜欢
    • 2018-09-13
    • 1970-01-01
    • 2023-03-11
    • 2019-12-03
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多