I'm trying to run this script in Google Apps script:
function onOpen() {
SpreadsheetApp
.getUi()
.createMenu('Create file')
.addItem('Create file', 'createFilesInFolder')
.addToUi()
} // onOpen()
function createFilesInFolder() {
//This creates the folder
var folder = DriveApp.createFolder("MojTest");
//This creates a file in the folder
var file = folder.createFile('My File.txt',
'Lorem ipsum',
MimeType.PLAIN_TEXT);
}
It always stacks on creating the folder and exceeded maximum execution time.
Here is Execution transcript when I try to debug function:
[17-10-03 12:43:14:743 PDT] Starting execution
[17-10-03 12:50:09:107 PDT] DriveApp.createFolder([MojTest]) [414.356 seconds]
[17-10-03 12:50:09:118 PDT] Execution failed: We're sorry, a server error occurred. Please wait a bit and try again. (line 15, file "Code") [414.358 seconds total runtime]
Also functions like DriveApp.getFoldersByName().next() have same problem.
Can you tell me how to fix this?