Skip to main content

Google Workspace

Google Workspace is Google's comprehensive cloud-based productivity and collaboration platform that includes Gmail, Google Calendar, Google Drive, Google Docs, Google Sheets, Google Slides, Google Meet, and other business applications. This integration provides access to query and analyze data across multiple Google Workspace services including email communications, calendar scheduling, file storage, and account settings.

CategoryCollaboration
DirectionQuery source
Sign-inService Account (Domain-Wide Delegation), OAuth 2.0 Client
Query languagesSQLite
Tables15
Query templates61
Websitegoogle.com

Before you start​

Huntbase can sign in to Google Workspace with any of these methods: Service Account (Domain-Wide Delegation), OAuth 2.0 Client. Pick one, create the credential in Google Workspace, then keep it to hand for the Connect step.

Service Account (Domain-Wide Delegation)​

Service-account credentials JSON (file path or contents) with domain-wide delegation, impersonating an admin user.

  1. In the Google Cloud console, select your project, click Enable APIs and Services, and enable the Google Calendar API, Google Drive API, Gmail API, Google People API and Google Admin SDK API.
  2. Go to Menu › IAM & Admin › Service Accounts, click Create service account, enter a name, and click Done.
  3. Click the service account's email, open the Keys tab, choose Add key › Create new key, select JSON, and click Create. The JSON key file downloads.
  4. On the service account's details, click Show advanced settings and copy the Client ID under Domain-wide delegation.
  5. In the Google Admin console, go to Menu › Security › Access and data control › API controls, click Manage Domain Wide Delegation, then Add new. Paste the Client ID, enter the read-only scopes below as a comma-separated list, and click Authorize.

Permissions:

  • https://www.googleapis.com/auth/admin.reports.audit.readonly
  • https://www.googleapis.com/auth/calendar.readonly
  • https://www.googleapis.com/auth/contacts.readonly
  • https://www.googleapis.com/auth/contacts.other.readonly
  • https://www.googleapis.com/auth/directory.readonly
  • https://www.googleapis.com/auth/drive.readonly
  • https://www.googleapis.com/auth/gmail.readonly

OAuth 2.0 Client​

OAuth 2.0 client secret credential file used to authenticate as a user.

  1. In the Google Cloud console, enable the same APIs as for the service account method and configure the OAuth consent screen.
  2. Go to Menu › Google Auth platform › Clients, click Create Client, choose Application type › Desktop app, and click Create. Download the client secret JSON file.
  3. Run gcloud auth application-default login --client-id-file=client_secret.json with the same read-only scopes as the service account method, and sign in as the user whose access Huntbase should use.
  4. Note the file path printed after Credentials saved to file:. That file is your credential.
Watch out for
  • Domain-wide delegation changes can take up to 24 hours to apply, but usually take effect sooner.

For the vendor's own instructions, see Google Workspace credentials documentation.

tip

Use a dedicated, read-only credential for Huntbase where the product allows it. Huntbase only needs to read.

Connect Google Workspace​

  1. Go to Connections and click New connection, or click New connection on the Google Workspace product page.
  2. On Product, pick Google Workspace and choose the Owner.
  3. On Details, give the connection a Name and, optionally, a Description.
  4. On Connect, fill in the settings and credentials described below.
  5. On Verify, review the summary and click Create & check.

For everything else on the setup page — saving a draft, I'll do this later, and what each check result means — see Connections.

Settings​

Where your Google Workspace lives:

FieldRequiredNotes
Impersonated User EmailNoRequired for the service account method. The email of a Workspace user with permission to use the Admin APIs, such as a Workspace admin.

Credentials​

Choose a Method, enter a Credential label (for example Production), then fill in the fields for that method.

Service Account (Domain-Wide Delegation)​

FieldRequiredNotes
Service Account CredentialsYesSecret — not shown again after you save it.

OAuth 2.0 Client​

FieldRequiredNotes
OAuth Token PathYesThe Application Default Credentials file that gcloud saves after you sign in, not the client secret JSON you downloaded. Secret — not shown again after you save it.

Query it​

Once connected, Google Workspace can serve these languages in a query tab, and Scout can use it when you ask in Auto:

LanguageUse it for
SQLiteSQL over the 15 tables listed below, alongside every other connected source.

Example: SQLite​

Gmail settings basic info — Explore the language settings and delegation details associated with your Google Workspace Gmail account.

select
user_email,
display_language,
delegates
from
googleworkspace_gmail_my_settings;

Google Workspace ships with 61 query templates. Find them in Library › Queries — see Query templates.

Tables​

Google Workspace adds 15 tables. Browse their columns from Schema in the query bar's ⋯ menu.

All 15 tables
TableContains
googleworkspace_activity_reportGoogle Workspace Activity Report
googleworkspace_calendarMetadata of the specified calendar.
googleworkspace_calendar_eventEvents scheduled on the specified calendar.
googleworkspace_calendar_my_eventEvents scheduled on the specified calendar.
googleworkspace_driveDrives defined user's shared drives in the Google Drive.
googleworkspace_drive_my_fileRetrieves file's metadata or content owned by an user.
googleworkspace_gmail_draftRetrieves draft messages in the specified user's mailbox.
googleworkspace_gmail_messageRetrieves messages in the specified user's mailbox.
googleworkspace_gmail_my_draftRetrieves draft messages in the current authenticated user's mailbox.
googleworkspace_gmail_my_messageRetrieves messages in the current authenticated user's mailbox.
googleworkspace_gmail_my_settingsRetrieves settings for the current authenticated user account.
googleworkspace_gmail_settingsRetrieves settings for the specified account.
googleworkspace_people_contactContacts owned by the authenticated user.
googleworkspace_people_contact_groupContact groups owned by the authenticated user
googleworkspace_people_directory_peopleDomain contacts in the authenticated user's domain directory.

Next steps​