The 'Spreadsheet App' is used to open the new file and get the Url of the Form (if there is one):
var formUrl = SpreadsheetApp.openById(newFileId).getFormUrl();Next the 'Form App' opens the newly created Google Form and gets its Id:
var form = FormApp.openByUrl(formUrl);With the Id we can perform the final 2 steps of un-linking the Google Form from the Response Sheet and then deleting it:
var formId = form.getId();
form.removeDestination();
DriveApp.getFileById(formId).setTrashed(true);
Remove Google Form created during copy.gs
No comments:
Post a Comment