我有一个谷歌表格,我没有编辑权限(我只能填写此表格并提交)。我想在指定时间自动提交此表单。有可能吗?如果是,我该怎么办呢。
我必须尝试使用goR形式的createResponse,但它仅适用于我拥有编辑权限的表单。
function autoSubmitForm() {
var ss = SpreadsheetApp.getActive();
var sheet = ss.getSheetByName("Sheet1");
var formUrl = "form URL"; // URL of the form
var form = FormApp.openByUrl(formUrl);
var items = form.getItems();
var formResponse = form.createResponse();
var page1 = items[0];
var rp_page1 = page1.asMultipleChoiceItem().createResponse("Page 2");
formResponse.withItemResponse(rp_page1);
var page2_1 = items[2];
var rp_page2_1 = page2_1.asMultipleChoiceItem().createResponse("Option 1");
formResponse.withItemResponse(rp_page2_1);
var page2_2 = items[3];
var rp_page2_2 = page2_2.asMultipleChoiceItem().createResponse("Option 2");
formResponse.withItemResponse(rp_page2_2);
var page2_3 = items[4];
var options = ["Option 1", "Option 2", "Option 4"];
var rp_page2_3 = page2_3.asCheckboxItem().createResponse(options);
formResponse.withItemResponse(rp_page2_3);
var submit = formResponse.submit();
Logger.log(submit);
Logger.log(submit.getId());
Logger.log(submit.getTimestamp());
var lastRow = sheet.getLastRow() + 1;
sheet.getRange(lastRow, 1).setValue(submit.getId());
sheet.getRange(lastRow, 2).setValue(submit.getTimestamp());
};