我有一个Google表单,可以使用一些自定义公式(过滤器,SQL查询,其他表格等)来提供对电子表格的响应 .
My users request a copy of this Form (the template) and I would like to automate the process of making a copy of the Google Form and the linked spreadsheet while keeping the custom functionality in that spreadsheet.
复制表单不是问题,但用户必须为要转到的响应创建新的电子表格(没有自定义功能) .
看起来手动制作工作表的副本(在 Cloud 端硬盘中)会自动创建链接的Google表单 . 但是我可以用脚本做到吗?如果是这样,我如何获得新复制的电子表格所附新创建的Google表单的ID?
任何建议都非常感谢 .
谢谢,
皮埃尔
1 回答
我现在正在使用它(我只是复制而不是创建):
https://developers.google.com/apps-script/reference/forms/destination-type
//按ID打开表单并创建新的电子表格 . var form = FormApp.openById('1234567890abcdefghijklmnopqrstuvwxyz'); var ss = SpreadsheetApp.create('Spreadsheet Name');
//更新表单的响应目标 . form.setDestination(FormApp.DestinationType.SPREADSHEET,ss.getId());