Excel Add-In for Google Ads

Build 24.0.9060

Establishing a Connection

Configure a Connection Profile

From the CData ribbon, click Get Data and select From Google Ads connection/s to launch the CData Query window. To setup a new connection, you will have to click the New Google Ads Connection button. Here you can set the connection settings, test the connection, and save the connection profile.

Connecting to Google Ads

Before you can add the properties needed to authenticate, you must provide the following connection properties:

  • DeveloperToken: The account developer token.
  • ClientCustomerId: Your Google Ads customer ID. To find your ClientCustomerId, click the Help icon at the upper right corner of the Google Ads UI, then look at the bottom of the help menu.

Retrieving Data from Multiple Accounts

A common use for the driver is retrieving data from multiple customer Ids. This is useful when you have a Google Ads MCC account that includes numerous accounts/ClientCustomerIds. You can query and get data from the accounts you want by specifying CustomerId in the WHERE clause. For example:
SELECT * FROM AdGroupAd WHERE CustomerId='3333333333'
SELECT * FROM AdGroupAd WHERE CustomerId IN ('1111111111', '2222222222')

When you specify the CustomerId in WHERE clauses, the driver ignores the ClientCustomerId connection property.

Authenticating to Google Ads

All connections to Google Ads are authenticated using OAuth. The add-in supports using user accounts, service accounts and GCP instance accounts for authentication.

User Accounts (OAuth/OauthPKCE)

Google Ads provides embedded OAuth credentials that simplify connection from a Desktop application . To connect from a Web application, you must create a custom OAuth application, as described in Creating a Custom OAuth Application.

To connect via OAuth from all authentication flows, you must set AuthScheme to OAuth.

The following subsections describe how to authenticate to Google Ads from the available oauth flows. For information about how to create a custom OAuth application, and why you might want to create one even for auth flows that already have embedded OAuth credentials, see Creating a Custom OAuth Application.

For a complete list of connection string properties available in Google Ads, see Connection.

Desktop Applications

CData provides an embedded OAuth application that simplifies authentication at the desktop. You can also authenticate from the desktop via a custom OAuth application, which you configure and register at the Google Ads console. For further information, see Creating a Custom OAuth Application.

Before you connect, set these properties:

  • InitiateOAuth: GETANDREFRESH. Used to automatically get and refresh the OAuthAccessToken.
  • Custom OAuth applications only:
    • OAuthClientId: The client Id assigned when you registered your custom OAuth application.
    • OAuthClientSecret: The client secret assigned when you registered your custom OAuth application.
    • CallbackURL: The redirect URI defined when you registered your custom OAuth application.

When you connect, the add-in opens Google Ads's OAuth endpoint in your default browser. Log in and grant permissions to the application.

When the access token expires, the add-in refreshes it automatically.

Service Accounts (OAuthJWT)

To authenticate using a service account, you must create a new service account and have a copy of the account's certificate.

For a JSON file, set these properties:

  • AuthScheme: Set this to OAuthJWT.
  • OAuthJWTCertType: Set this to GOOGLEJSON.
  • OAuthJWTCert: Set this to the path to the .json file provided by Google.
  • OAuthJWTSubject:The service account should be part of a GSuite domain, with delegation enabled. The value of this property should be the email address of the user whose data you want to access.

For a PFX file, set these properties:

  • AuthScheme: Set this to the email address of the service account. This address usually includes the domain iam.gserviceaccount.com.
  • OAuthJWTSubject: The service account must part of a GSuite domain, with delegation enabled. The value of this property is the email address of the user whose data you want to access.

If you do not already have a service account, you can create one by following the procedure in Creating a Custom OAuth Application.

GCP Instance Accounts

When running on a GCP virtual machine, the add-in can authenticate using a service account tied to the virtual machine. To use this mode, set AuthScheme to GCPInstanceAccount.

Connection Properties

The Connection properties describe the various options that can be used to establish a connection.

Managing Connections

After successfully authenticating to Google Ads you will be able to customize the data you are importing. To learn more about this, see Managing Connections.

See Also

Copyright (c) 2024 CData Software, Inc. - All rights reserved.
Build 24.0.9060