> ## Documentation Index
> Fetch the complete documentation index at: https://docs.getomni.co/llms.txt
> Use this file to discover all available pages before exploring further.

# Google Workspace

> Connect Google Drive, Docs, Sheets, Slides, Gmail, and Google Chat to Omni

The Google Workspace connector enables Omni to index and search content from your organization's Google Workspace environment, including Drive, Docs, Sheets, Slides, optionally Gmail, and optionally Google Chat.

## Overview

### What Gets Indexed

| Source | Content |
| - | - |
| Google Drive | Files, folders, and metadata |
| Google Docs | Full document text and comments |
| Google Sheets | Sheet names, cell content, and formulas |
| Google Slides | Slide text and speaker notes |
| Gmail (optional) | Email subjects, bodies, and supported attachments |
| Google Chat (optional) | Spaces, messages, threads, membership metadata, and linked Drive attachments |

### How It Works

1. Organization-wide sources use a service account with domain-wide delegation; a plain service account can sync selected shared drives directly (see [Service Account Direct (Shared Drives)](#service-account-direct-shared-drives-no-domain-wide-delegation)). Personal connections use the user's Google OAuth authorization.
2. The connector syncs content within the configured Drive scope and source permissions
3. Permission inheritance ensures users only see content they have access to in Google Workspace

> [!NOTE]
>
> Google Workspace syncing uses read-only access. Some agent actions can request separate user OAuth authorization for write-capable Google APIs; see [User OAuth for Tools](#user-oauth-for-tools).

## Prerequisites

Before setting up the Google Workspace connector, ensure you have:

* **Google Cloud Platform account** with billing enabled
* **Google Workspace admin access** (Super Admin or delegated admin)
* **Google Cloud CLI** (`gcloud`) installed and authenticated (optional, for enabling APIs via CLI)

## Setup

### Step 1: Create a Google Cloud Project

1. Go to the [Google Cloud Console](https://console.cloud.google.com)
2. Click **Select a project** → **New Project**
3. Enter project name: `omni-workspace-integration`
4. Select your organization
5. Click **Create**

### Step 2: Enable Required APIs

In your new project, enable these APIs:

```bash theme={null}
gcloud services enable admin.googleapis.com
gcloud services enable drive.googleapis.com
gcloud services enable gmail.googleapis.com
gcloud services enable docs.googleapis.com
gcloud services enable sheets.googleapis.com
gcloud services enable slides.googleapis.com
gcloud services enable chat.googleapis.com
```

Or enable via Console: **APIs & Services** → **Library** → Search and enable each API.

### Step 3: Create Service Account

1. Go to **IAM & Admin** → **Service Accounts**
2. Click **Create Service Account**
3. Name: `omni-workspace-connector`
4. Description: `Service account for Omni Google Workspace integration`
5. Click **Create and Continue**
6. Skip the optional steps and click **Done**

### Step 4: Get the Client ID

1. Click on the newly created service account
2. Go to the **Details** tab
3. Under **Advanced settings**, copy the **Client ID** (also shown as the service account's Unique ID) — you'll need this in Step 6 to authorize domain-wide delegation

### Step 5: Create Service Account Key

1. Go to the **Keys** tab
2. Click **Add Key** → **Create new key**
3. Select **JSON** format
4. Click **Create**
5. Save the downloaded key file securely

> [!WARNING]
>
> This key file provides access to your entire Google Workspace domain. Store it securely and never commit it to version control.

### Step 6: Configure Domain-Wide Delegation in Admin Console

1. Open the [Google Workspace Admin Console](https://admin.google.com)
2. Navigate to **Security** → **Access and data control** → **API controls**
3. Click **Manage Domain Wide Delegation**
4. Click **Add new**
5. Enter the **Client ID** from Step 4
6. Add the following OAuth scopes:

```
https://www.googleapis.com/auth/admin.directory.user.readonly,
https://www.googleapis.com/auth/admin.directory.group.readonly,
https://www.googleapis.com/auth/drive.readonly,
https://www.googleapis.com/auth/gmail.readonly,
https://www.googleapis.com/auth/documents.readonly,
https://www.googleapis.com/auth/spreadsheets.readonly,
https://www.googleapis.com/auth/presentations.readonly,
https://www.googleapis.com/auth/chat.spaces.readonly,
https://www.googleapis.com/auth/chat.memberships.readonly,
https://www.googleapis.com/auth/chat.admin.memberships.readonly,
https://www.googleapis.com/auth/chat.messages.readonly
```

7. Click **Authorize**

> [!WARNING]
>
> If Gmail or Google Chat access is not needed, exclude the corresponding Gmail or Chat scopes. Google Chat sync requires the Chat API to be enabled and domain-wide delegation for the Chat scopes above.

### Step 7: Configure Omni

1. Navigate to **Settings** → **Integrations** in Omni
2. Find **Google Workspace** and click **Connect**
3. Choose whether to create **Google Drive**, **Gmail**, **Google Chat**, or any combination of those sources
4. Paste the contents of the service account key file from Step 5
5. Enter your Google Workspace domain
6. Enter the admin email address
7. Click **Connect**
8. Use **Settings** on each created source to adjust source settings, then click **Sync** to start the initial sync

> [!TIP]
>
> Your Google Workspace connector is now configured. Initial indexing may take a while, depending on the amount of content in your Google account.

## Personal Google OAuth

After an admin configures the Google OAuth client under **Settings** → **Integrations** → **OAuth Apps**, users can connect their own Google account from **My Integrations** → **Connect your Google account**. OAuth can create personal **Google Drive** and **Gmail** sources using read-only Google scopes; it does not require domain-wide delegation or Google Workspace admin scopes.

A personal Drive source starts in a pending state until its owner chooses either **Entire Drive** or **Selected folders**. Folder discovery can include the user's My Drive, accessible shared drives, and folders beneath them. Sync runs with that user's credential and indexes only content the account can access.

***

## Service Account Direct (Shared Drives, no Domain-Wide Delegation)

The setup dialog has two tabs: **Domain-wide delegation** (the flow above) and **Shared drive (no DWD)**. The second tab is Drive-only and uses a plain service account to sync selected shared drives with their effective permissions. It needs no domain-wide delegation or `sub` impersonation, but it does require the Admin Directory group-read scope for group membership sync.

### Google-Side Setup

1. Create a service account key (**IAM & Admin** → **Service Accounts** → **Keys**)
2. Ensure the service account itself can list Workspace groups and group members through the Admin SDK without impersonation, for example through an appropriate customer-level admin role. Omni validates this access before creating the source
3. In each shared drive → **Manage members**, add the service account email (`<name>@<project>.iam.gserviceaccount.com`) as **Content manager** (`fileOrganizer`) or **Manager** (`organizer`). Without one of these roles the service account cannot read the drive's ACLs, and the connector will not sync the drive
4. Verify your Workspace external-sharing policy permits adding `*.iam.gserviceaccount.com` to shared drives. The service account is an external principal, so a scoped OU / trust-rule exception may be needed. If the policy cannot allow the service account at all, use OAuth or domain-wide delegation instead

### Behavior

* `drive.readonly` and `admin.directory.group.readonly` are required; the source config selects this mode with `auth_mode: "service_account_direct"`, a Workspace `domain`, and one or more `folder_path_filters` entries of kind `shared_drive_root`
* The drive member list supplies each document's baseline `public`/`users`/`groups` permissions; the service account's own email is excluded
* Effective permissions mirror Google's shared-drive model: direct grants on ancestor folders and files are added, and a limited-access folder boundary replaces inherited access with drive organizers plus direct grants at that boundary
* Drive and relevant folder ACLs are fingerprinted; a change triggers a full drive re-traversal so existing documents get the new permissions
* Polling only; no webhook registration. Google Groups on the drive map to `groups`. Setup verifies that the service account can list Workspace groups and members, and the connector emits group-membership events during sync. If group sync later fails, group-granted documents are visible only to users whose memberships are supplied by another source
* Switching an existing domain-wide-delegation source to service-account-direct is not supported; create a new source instead

The setup dialog validates Workspace group/member access and the service account's role on every selected drive before the source is created, and the drive settings page repeats the shared-drive access validation before Save.

## Managing the Integration

### Gmail Attachments

When Gmail is enabled, Omni indexes supported message attachments in addition to message bodies. Supported attachment formats include PDFs, DOCX, XLSX, PPTX, XLS, text, HTML, CSV, and Markdown. Unsupported binary formats are skipped.

### Google Chat

When Google Chat is enabled, Omni indexes accessible spaces and messages as a separate **Google Chat** source. Chat messages retain space/thread context and permission metadata from Chat memberships. Linked Drive attachments are indexed through the same Drive access path when available.

### Drive Folder Filtering

Drive indexing scope depends on how the source is authenticated:

* **Domain-wide delegation**: Admins can select shared drives or folders within them. If no folders are selected, all content available through the source is indexed. Personal My Drive folder scopes are not supported for service-account sources; use personal OAuth instead.
* **Personal Google OAuth**: The account owner can choose **Entire Drive** or selected folders from My Drive and accessible shared drives. The owner manages this scope from **My Integrations**.
* **Service-account direct**: The source must select at least one whole shared drive. Folder-level restrictions are not supported in this mode.

For existing organization sources, navigate to **Settings** → **Integrations**, find the Drive source, and click **Settings**. For personal sources, open **My Integrations** and choose **Manage folders** or **Choose folders** on the Drive connection.

When a scope is selected, the connector enforces it during full and incremental syncs using ancestry checks. Changing a scope starts a full sync so newly selected content is discovered; files removed from a selection may remain searchable until cleanup completes. Deselecting folders in a mode that permits an empty selection restores index-all behavior.

### User OAuth for Tools

The service account handles org-wide indexing. Some Omni agent tools require a user's own Google authorization instead of the service account. Configure the Google client from **Settings** → **Integrations** → **OAuth Apps**, then use the shared redirect URI shown there when creating the OAuth client in Google Cloud. When a tool needs user authorization, the chat UI prompts the user to connect their Google account.

### AI Tools and Skills

The Google connector exposes the entire Google Workspace API surface as MCP tools for Omni through two actions:

* **`google_workspace_schema`** — fetches API method schemas so the assistant can discover available operations and their parameters
* **`google_workspace_call`** — executes API calls against Drive, Docs, Sheets, Slides, and Gmail

The connector also ships domain-aware skills that guide the assistant through common Workspace tasks:

* **Google Drive skill** — search and read files, manage permissions, create and update Docs/Sheets/Slides via the API
* **Gmail skill** — search, read, and manage messages and threads with Gmail query syntax

These skills are automatically loaded into Omni when the connector is enabled. They ensure the agent follows best practices — searching before reading, using stable IDs over fragile names, and choosing the right API surface for each task.

### Viewing Sync Status

Navigate to **Settings** → **Integrations** to view the sync status for each source directly on the list, including last sync time, number of indexed items, and any errors. Click **Settings** on a source for more details and sync history.

### Rotating Service Account Keys

It's recommended to rotate service account keys every 90 days.

1. Create a new key in Google Cloud Console
2. Update the key in Omni settings
3. Delete the old key

### Removing the Integration

1. Navigate to **Settings** → **Integrations**
2. Click **Settings** against the Google Workspace source
3. Click **Delete Permanently**
4. Optionally, delete the service account in Google Cloud and remove the domain-wide delegation entry in Admin Console

***

## Troubleshooting

> [accordion] Insufficient permissions
>
> The setup requires:
>
> * **Project Creator** - to create the GCP project
> * **Google Workspace Super Admin** - for domain-wide delegation
>
> Some permissions may take 10-15 minutes to propagate.

> [accordion] API not enabled error
>
> APIs may take a few minutes to propagate after enabling. Check status:
>
> ```bash theme={null}
> gcloud services list --enabled --project=YOUR_PROJECT_ID
> ```

> [accordion] Domain-wide delegation not working
>
> Common causes:
>
> * Client ID mismatch - verify the ID in Admin Console matches the service account
> * Missing scopes - ensure all required scopes are added
> * Propagation delay - wait 5-10 minutes for changes to take effect
> * Wrong admin email - ensure the admin email has Google Workspace admin privileges

> [accordion] Sync taking too long
>
> Initial sync duration depends on:
>
> * Number of users in your organization
> * Amount of content in Drive and Gmail
> * API quota limits
>
> For large organizations (1000+ users), initial sync may take 24-48 hours. You can monitor progress in the Omni admin panel.

## Security Considerations

* **Read-only access**: The service account only has read permissions
* **Permission inheritance**: Users only see content they can access in Google Workspace
* **Key security**: Service account keys should be treated like passwords
* **Audit logging**: Enable Cloud Audit Logs to monitor API access
* **Key rotation**: Rotate service account keys every 90 days

## What's Next

> [card] [Search Your Data](https://docs.getomni.co/user-guide/search.md)
>
> Learn how to search across Google Workspace content

> [card] [Omni Agent](https://docs.getomni.co/user-guide/ai-assistant.md)
>
> Ask questions about your documents and emails

> [card] [Add More Connectors](https://docs.getomni.co/connectors/overview.md)
>
> Connect additional data sources


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.