I have an Apps Script that creates multiple files and moves them into a folder. Is there a way to place the a file directly in a folder or do I first have to get the file then copy it to the appropriate folder and then removing it from the root folder like this:
folder=DocsList.createFolder("MyFolder");
var file=DocsList.createFile(blob);
file.addToFolder(folder);
file.removeFromFolder(DocsList.getRootFolder());
The problem with this is that if you open up Drive you see the file is first placed in the root folder then moved to MyFolder. So there is a bit of a lag until the execution of removeFromFolder.
Just tested the following code
It works as expected, i.e. created a new
File1document in newly created folderMy Drive\Folder1\Subfolder1.