We are glad to announce support for Google Drive in AdWords scripts. The functionality is exposed through the
DriveApp bean that allows scripts to create, find, and modify files and folders in Google Drive. Scripts uses OAuth2 as the authentication mechanism to determine which files the current user has access to on Google Drive.
One of the potential use of Drive is as an intermediary data storage between your application and your script. A couple of hypothetical use cases are:
Manage ads by inventory
- First, install a Google Drive client locally on your computer and map a local disk folder to your “My Drive” folder in Google Drive.
- Write an internal script to query the inventory database and dump results into an XML file to your local Google Drive folder.
- Write an AdWords script that reads that same file using DriveApp and pauses or enables ads accordingly.
Importing stats to a local database
- Install a Google Drive client locally on your computer and map a local disk folder to your “My Drive” folder in Google Drive.
- Write an AdWords script that fetches daily stats and dumps them into a CSV file on Drive daily.
- Create a local cron job to read that file and push its data into a local database.
DriveApp gives you certain advantages over SpreadsheetApp and
UrlFetch APIs when exchanging data with your local server.
- Google Spreadsheets have size limitations, and is not the format of choice for all our developers.
- UrlFetch is more flexible than DriveApp, but it requires you to set up your own local server to exchange data with Scripts in a secure manner.
We hope you enjoy this new feature. If you have questions or feedback, please visit us on our
official forum.
- Anash P. Oommen, AdWords Scripts Team