需要复制谷歌电子表格(自定义公式)和链接的谷歌表单

Need to duplicate Google spreadsheet (with custom formulas) and linked Google form

本文关键字:谷歌 链接 表单 自定义 复制 电子表格      更新时间:2023-09-26

我有一个Google Form,它提供了一些自定义公式(过滤器,SQL查询,其他表格等)的电子表格响应。

我的用户请求此表单(模板)的副本,我想使谷歌表单和链接的电子表格的副本的过程自动化,同时保持自定义功能在该电子表格。

复制表单不是问题,但随后用户必须创建一个新的电子表格以供响应(没有自定义功能)。

看起来像手动复制工作表(在驱动器中)自动创建一个链接的谷歌表单。但我能用脚本做到吗?如果是这样,我如何获得与新复制的电子表格一起新创建的Google Form的ID ?

请多多指教。

谢谢你,皮埃尔

我现在使用这个(我只是复制而不是创建):

https://developers.google.com/apps-script/reference/forms/destination-type

 // Open a form by ID and create a new spreadsheet.
 var form = FormApp.openById('1234567890abcdefghijklmnopqrstuvwxyz');
 var ss = SpreadsheetApp.create('Spreadsheet Name');
 // Update the form's response destination.
 form.setDestination(FormApp.DestinationType.SPREADSHEET, ss.getId());