External Data Integration
Stay organized with collections
Save and categorize content based on your preferences.
Important data (inventory, conversions, etc.) often reside outside the Google
Ads domain. Likewise, the Google Ads UI may not always be the perfect
tool for data visualization. Google Ads scripts provide an easy way to
integrate with external data sources.
Google Spreadsheets
Google Spreadsheets (found in Google Drive) are a
full-featured web-based spreadsheet solution. Google Ads scripts lets you read
from and write to spreadsheets through the
Spreadsheet Service. You can also
programmatically create a spreadsheet, populate it with data, format its fonts
and colors, and share it with others. Some of the ways you can use them in your
scripts include:
- Report visualization
- Spreadsheets offer various types of charts. You can set up a spreadsheet with
a chart to visualize your data, and then import the data source from a script to
automatically update the chart.
- Data source
- You can create a spreadsheet where you manually input data (or input data
from some other source). A script can then read and process the data to update
your account. For example, you can enter new keywords to a spreadsheet that are
then added to your account by a daily running script.
- Intermediate data store
- A spreadsheet can store information about its execution state as it runs, so
that it can pick up where it left off on the next execution. For example, if
you need to process all ad groups in your account but it takes longer than the
30 minute execution time limit, you can
record the ones you process as you go. When the script executes again, it can
check the spreadsheet to figure out where to start so it doesn't duplicate any
work.
Google Drive
You can further leverage Google Drive with
DriveApp
which lets scripts create,
find, and modify arbitrary files on Google Drive. This can be used as a data
source or intermediate datastore as previously shown.
Charts
Enhanced data visualization is also available through the
Charts Service. This full-fledged chart
building service gives you extensive control over your data visualization
needs.
JDBC
You can connect to external JDBC-compliant databases such as Google Cloud SQL,
MySQL, Microsoft SQL Server, and Oracle databases. See this
guide for set-up instructions.
Email
Google Ads scripts let you send out emails through the
Mail Service. Email can be used for
notifying yourself of any pertinent information you need from the script; for
example, mailing out a summary with a link to a full report. You can customize
the email message with custom HTML and even add images, allowing the script to
send professional-looking reports directly to your clients. Attachments can be
used to send large reports.
URL fetching
Google Ads scripts let you fetch the content of an arbitrary URL using the
Url Fetch Service. This feature opens
up a range of opportunities:
- Set up a password-protected feed on your website that reports inventory
information. Then, access it through a Google Ads script in order to apply
account changes.
- Fetch information about external events and make account management decisions
based on that information. For example, you could fetch weather information
from an HTTP-based API and adjust bids or enable ads whenever it's raining in
your target area.
- There are a wide variety of APIs available across the web; anything that has
an HTTP interface is accessible.
Except as otherwise noted, the content of this page is licensed under the Creative Commons Attribution 4.0 License, and code samples are licensed under the Apache 2.0 License. For details, see the Google Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.
Last updated 2025-08-25 UTC.
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Missing the information I need","missingTheInformationINeed","thumb-down"],["Too complicated / too many steps","tooComplicatedTooManySteps","thumb-down"],["Out of date","outOfDate","thumb-down"],["Samples / code issue","samplesCodeIssue","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2025-08-25 UTC."],[[["\u003cp\u003eGoogle Ads Scripts facilitates integration with external data sources for enhanced data analysis and automation.\u003c/p\u003e\n"],["\u003cp\u003eGoogle Sheets, Drive, and Charts services can be used for data visualization, storage, and reporting within Google Ads Scripts.\u003c/p\u003e\n"],["\u003cp\u003eExternal databases and custom web applications can be connected to Google Ads Scripts via JDBC and URL Fetching services.\u003c/p\u003e\n"],["\u003cp\u003eEmail functionality enables automated notifications and reporting based on script outputs.\u003c/p\u003e\n"],["\u003cp\u003eGoogle Ads Scripts empowers users to programmatically control and automate Google Ads campaigns with external data and services.\u003c/p\u003e\n"]]],[],null,["# External Data Integration\n\nImportant data (inventory, conversions, etc.) often reside outside the Google\nAds domain. Likewise, the Google Ads UI may not always be the perfect\ntool for data visualization. Google Ads scripts provide an easy way to\nintegrate with external data sources.\n\nGoogle Spreadsheets\n-------------------\n\nGoogle Spreadsheets (found in [Google Drive](//drive.google.com)) are a\nfull-featured web-based spreadsheet solution. Google Ads scripts lets you read\nfrom and write to spreadsheets through the\n[Spreadsheet Service](/apps-script/reference/spreadsheet). You can also\nprogrammatically create a spreadsheet, populate it with data, format its fonts\nand colors, and share it with others. Some of the ways you can use them in your\nscripts include:\n\nReport visualization\n: Spreadsheets offer various types of charts. You can set up a spreadsheet with\n a chart to visualize your data, and then import the data source from a script to\n automatically update the chart.\n\nData source\n: You can create a spreadsheet where you manually input data (or input data\n from some other source). A script can then read and process the data to update\n your account. For example, you can enter new keywords to a spreadsheet that are\n then added to your account by a daily running script.\n\nIntermediate data store\n: A spreadsheet can store information about its execution state as it runs, so\n that it can pick up where it left off on the next execution. For example, if\n you need to process all ad groups in your account but it takes longer than the\n [30 minute execution time limit](/google-ads/scripts/docs/limits), you can\n record the ones you process as you go. When the script executes again, it can\n check the spreadsheet to figure out where to start so it doesn't duplicate any\n work.\n\nGoogle Drive\n------------\n\nYou can further leverage Google Drive with\n[`DriveApp`](/apps-script/reference/drive/drive-app) which lets scripts create,\nfind, and modify arbitrary files on Google Drive. This can be used as a data\nsource or intermediate datastore as previously shown.\n\nCharts\n------\n\nEnhanced data visualization is also available through the\n[Charts Service](/apps-script/reference/charts). This full-fledged chart\nbuilding service gives you extensive control over your data visualization\nneeds.\n\nJDBC\n----\n\nYou can connect to external JDBC-compliant databases such as Google Cloud SQL,\nMySQL, Microsoft SQL Server, and Oracle databases. See [this\nguide](/apps-script/guides/jdbc) for set-up instructions.\n\nEmail\n-----\n\nGoogle Ads scripts let you send out emails through the\n[Mail Service](/apps-script/reference/mail). Email can be used for\nnotifying yourself of any pertinent information you need from the script; for\nexample, mailing out a summary with a link to a full report. You can customize\nthe email message with custom HTML and even add images, allowing the script to\nsend professional-looking reports directly to your clients. Attachments can be\nused to send large reports.\n\nURL fetching\n------------\n\nGoogle Ads scripts let you fetch the content of an arbitrary URL using the\n[Url Fetch Service](/apps-script/reference/url-fetch). This feature opens\nup a range of opportunities:\n\n- Set up a password-protected feed on your website that reports inventory information. Then, access it through a Google Ads script in order to apply account changes.\n- Fetch information about external events and make account management decisions based on that information. For example, you could fetch weather information from an HTTP-based API and adjust bids or enable ads whenever it's raining in your target area.\n- There are a wide variety of APIs available across the web; anything that has an HTTP interface is accessible."]]