I'm trying to write a google apps script for creating a google form quiz based on a question bank contained in a google spreadsheet.
The minimal working example I have coded so far seems to work all right, but I'm not sure my code is entirely correct, let alone optimized. I'll probably share it in a different post later.
Right now I'd like to ask a more general question. I'm not sure I understand completely how "document creation" works in google docs.
My code creates a new form via
var form = FormApp.create('QBANK_1_form');
The actual form is created in the "root" of my google drive. Also, if I run my script multiple times (for debugging purposes), many forms by the same name are created.
Instead, I'd like an unique version of the form to be created in a specific drive folder.
So my question is: what is the correct way to create a form in a chosen drive folder, overwriting a possibly existing file by the same name?
If I get it right, this post seems to suggest that the only way to achieve that is creating the document as above and moving it to the proper folder via the DriveApp.
Is this correct? If so, should I move the document after it is completed or can I do that right after creating it?