How do I create a Google document in a Google Drive folder?
I know that I can create a file in a folder like this.
var folder = DriveApp.createFolder("A Folder")
folder.createFile("filename.file", "Some text")
But how I can create a document in a folder using Google Apps Script.
The other answer is correct but the file will exist in your folder AND in your "drive" folder (the root folder).
To avoid that, simply remove it from there !
code :
var doc = DocumentApp.create('Document Name'),
docFile = DriveApp.getFileById( doc.getId() );
DriveApp.getFolderById('0B3°°°°°°°1lXWkk').addFile( docFile );
DriveApp.getRootFolder().removeFile(docFile);