如何使用 Google App 脚本复制表单
How to duplicate form using Google App Script
我有一个 Google 表格需要复制。我想为团队中的每个人(30 多人)创建不同的表格。
我调查了 the documentation,但找不到复制该表单的方法。
这就是我想要做的:
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...
有什么方法可以使用 Google App Script 复制表单吗?
表单服务 只能创建、访问和修改Google 表单。要复制表格,您必须使用 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()
}
模板格式:
输出:
参考文献:
我有一个 Google 表格需要复制。我想为团队中的每个人(30 多人)创建不同的表格。
我调查了 the documentation,但找不到复制该表单的方法。
这就是我想要做的:
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...
有什么方法可以使用 Google App Script 复制表单吗?
表单服务 只能创建、访问和修改Google 表单。要复制表格,您必须使用 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()
}
模板格式:
输出: