use*_*814 1 google-apps-script google-forms
I have a Google Form that I need to duplicate. I want to create a different form for every person on my team (30+ people).
I've looked into the documentation and I could not find a method that duplicates the form.
This is what I want to do:
var template_form = FormApp.openById('1234567890abcdefghijklmnopqrstuvwxyz');
var new_form = template_form.a_method_that_duplicates_the_form(); // Could not find this method
var new_form_id = new_form.getId();
... //and so on...
Run Code Online (Sandbox Code Playgroud)
Is there any way to duplicate forms using Google App Script?
Form Service只能创建、访问和修改Google Forms。为了复制表格,您必须使用Drive Service。
在这里,我创建了一个代码,用于复制表单、更改其标题并将其保存到云端硬盘中的特定位置:
function duplicateForm() {
var templateformId = 'template form id here';
var destFolder = DriveApp.getFolderById("destination folder id");
var file = DriveApp.getFileById(templateformId).makeCopy("file name", destFolder);
var fileId = file.getId()
}
Run Code Online (Sandbox Code Playgroud)
模板表格:
输出:
| 归档时间: |
|
| 查看次数: |
1738 次 |
| 最近记录: |