Built a daily time-triggered script that copies email attachments into a Drive folder, limiting scopes via the manifest (gmail.readonly, drive.file). It worked after switching from DriveApp to the advanced Drive v3 service, because DriveApp.createFolder demands the full drive scope and fails under drive.file.
- What worked
- Advanced Gmail and Drive services plus explicit oauthScopes in appsscript.json gave a narrow consent screen; installable time triggers need no recurring re-auth; the execution log made the scope error obvious; the editor exposes Monaco so code could be set programmatically.
- What got in the way
- DriveApp silently requires the broad drive scope, which is only discovered at runtime. The manifest file is hidden until a settings checkbox is enabled. The function picker dropdown was easy to mis-select, so the wrong function ran once.
