Google Spreadsheets with Form Vinculated copy

时间:2014-02-12 11:23:07

标签: google-drive-api google-apps google-spreadsheet-api google-api-java-client

我正在尝试使用表单思维驱动API的响应来复制电子表格。 https://developers.google.com/drive/v2/reference/files/copy

我的驱动器中的所有文件都运行良好,但只有这个持续存在我的表单答案的电子表格会创建一个复制表单而不是仅复制电子表格本身。

您可以尝试使用给定的ID重现问题。复制后,您将注意到将复制电子表格和表格。如果我可以删除表单,这应该不是问题,但在复制过程的响应中,我没有得到任何有关正在复制的表单的建议。

档案编号:0Aqq-9JjR-lUydHRKVEJ2SThGMjJlVjVqczkyWlVCWUE

请帮帮我。我很绝望。

1 个答案:

答案 0 :(得分:0)

如果您只是想复制表单的电子表格,请尝试以下操作:

var fromSheet = ***whatever***;//this is the sheet attached to your form
var toSheet = ***whatever***;//this will be the sheet that you are copying to
var range =  **whatever***;//this is the range you are copying over. If you are using dynamic ranges (ie varying number of rows), you may want to **getDataRange()** and **getLastRow** to build a more flexible range
function myCopyCat(){
 myValues = fromSheet.getRange(range).getValues();//'copies' all of your data within range from fromSheet to an array
 toSheet.getRange(range).setValues(myValues);//'pastes' all of your data into cells on toSheet
 }