Adapted from https://www.amixa.com/blog/2019/04/05/automatically-empty-google-drive-trash/
- Make sure you use Google's Chrome web browser for best results.
- Open Chrome and go to www.google.com.
- Make sure you are signed into your Google account. If not, sign in.
- You should obviously have Google Drive account up and running.
- Visit https://script.google.com/home and click NEW PROJECT
- Clear out the default code that appears in the next window, and paste in the following:
function createTimeDrivenTriggers() {
ScriptApp.newTrigger('emptyThrash')
.timeBased()
.everyHours(1)
.create();
}
function emptyThrash() {
Drive.Files.emptyTrash();
}
- Click the Save Icon.
- Enter a name such as “Automatically Empty Google Drive Trash”.
- Click the Resources -> Advanced Google Services” menu within the Code editor.
- Scroll down and turn Drive API to ON.
- You should see a message “These services must also be enabled in the Google Cloud Platform API Dashboard”. Click that link.
- N.B.: If you DO NOT see the message above, click this direct link.
- Click ENABLE APIS AND SERVICES.
- Locate Google Drive API and click it.
- Click Enable.
- Return to the browser window with Advanced Google Services still open and click OK.
- Click the Run icon within the project editor.
- You should see “Authorization Required”. Click Review Permissions.
- Choose your Google account (this step links the script to the proper account).
- You will see “This app isn’t verified”. Click Advanced, then click Go to XXXX Project (unsafe).
- Click ALLOW.
- Save your project again.
- Go to Run->Run Function->createTimeDrivenTriggers.
- Hit the Timer icon.
- You should see your project listed under Triggers.
Your job is now scheduled to run every hour and empty your trash.