I have a google form script that I want to create a spreadsheet in the same folder as the form.
var thisFileId = form.getId();
var parentFolder = DriveApp.getFolderById(thisFileId)
spreadsheet = SpreadsheetApp.create(spreadsheetName);
var spreadsheetID = spreadsheet.getId();
var spreasheetFile = DriveApp.getFileById(spreadsheetID);
spreasheetFile.moveTo(parentFolder);
I get an error on the last line :
"Exception: Invalid argument: parent.mimeType"
I believe your goal as follows.
form.getId()
.form
of form.getId()
, if form
is the Google Form, form.getId()
is the file ID of Google form. I think that this might be the reason of your issue.form
, it is required to retrieve the parent folder of form
.When above points are reflected to your script, it becomes as follows.
var parentFolder = DriveApp.getFolderById(thisFileId)
var parentFolder = DriveApp.getFileById(thisFileId).getParents().next();
DriveApp.getFolderById(id)
, no error occurs.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.