> ## Documentation Index
> Fetch the complete documentation index at: https://support.i.moneyforward.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Google Drive integration

> Connect Google Drive as a knowledge source with a service account so the AI agent can search and reference Google Drive files when answering inquiries

Connect Google Drive as a knowledge source. The AI agent can then search and reference Google Drive files when answering employee inquiries.

You connect Google Drive with a Google Cloud service account.
The service account reads Google Drive as a dedicated Google Workspace admin user, using Domain-Wide Delegation.

<Note>
  AI Helpdesk requests read-only access only and never modifies your Google Drive files.
</Note>

## Prerequisites

<Info>
  * **Admin** role in AI Helpdesk is required
  * You need a dedicated Google Workspace admin user for the service account to impersonate. This user needs the Groups Reader, User Management Admin, and Storage Admin roles
  * You need a Google Cloud service account and its service account key (JSON file)
  * Set up Domain-Wide Delegation so that the service account can impersonate the admin user above (see [Prepare Google Workspace](#prepare))
  * Knowledge sources must be initialized. If the **Knowledge sources** section shows the **Initialize Knowledge sources** button, click it and wait until initialization finishes
</Info>

<Warning>
  AI Helpdesk does not apply the sharing settings of Google Drive files. Imported files can be used to answer questions from every employee in your organization who uses AI Helpdesk.

  Take care when connecting drives that contain sensitive files. Before you start the first sync, limit what to import. For details, see [Set what to import](#crawl-scope).
</Warning>

<h2 id="prepare">
  Prepare Google Workspace
</h2>

Before you connect, complete the following setup in Google Cloud and the Google Workspace Admin Console. A Google Workspace admin must do this.

<Steps>
  <Step title="Enable the APIs">
    In Google Cloud, open **APIs & Services > Library** for the project where you create the service account, and enable the following three APIs.

    * Google Drive API
    * Google Drive Activity API
    * Admin SDK API
  </Step>

  <Step title="Create a service account and key">
    Create a service account under **APIs & Services > Credentials**.
    On the details page of the service account, take note of its Unique ID.
    Create a key in JSON format, and keep the downloaded JSON file in a safe place.
  </Step>

  <Step title="Authorize the OAuth scopes in the Google Workspace Admin Console">
    Open [https://admin.google.com](https://admin.google.com) and go to **Security > Access and data control > API controls**.
    Under **Manage Domain Wide Delegation**, click **Add new**.

    * **Client ID**: the Unique ID noted in the previous step
    * **OAuth scopes**: enter the six scopes below as a **single comma-separated line**

      * `https://www.googleapis.com/auth/drive.readonly`
      * `https://www.googleapis.com/auth/drive.metadata.readonly`
      * `https://www.googleapis.com/auth/admin.directory.user.readonly`
      * `https://www.googleapis.com/auth/admin.directory.group.readonly`
      * `https://www.googleapis.com/auth/cloud-platform`
      * `https://www.googleapis.com/auth/forms.body.readonly`

      Copy the following line as-is (no whitespace between commas):

      ```text theme={null}
      https://www.googleapis.com/auth/drive.readonly,https://www.googleapis.com/auth/drive.metadata.readonly,https://www.googleapis.com/auth/admin.directory.user.readonly,https://www.googleapis.com/auth/admin.directory.group.readonly,https://www.googleapis.com/auth/cloud-platform,https://www.googleapis.com/auth/forms.body.readonly
      ```

    Click **Authorize**.
  </Step>

  <Step title="Create the admin user to impersonate">
    In the Admin Console, create a dedicated user under **Directory > Users**.
    Assign the Groups Reader, User Management Admin, and Storage Admin admin roles to this user.
    Enter this user's email address in **Admin Account Email (to impersonate)** when you connect.
  </Step>
</Steps>

<h2 id="connect">
  Connect Google Drive
</h2>

### Required information

| Field | Description | Example |
| - | - | - |
| **Admin Account Email (to impersonate)** | Email of the dedicated Google Workspace admin user that the service account impersonates | `admin@example.com` |
| **Service Account Email** | Email of the service account to connect with | — |
| Private key | Value of `private_key` in the service account key (JSON file) | — |

<Steps>
  <Step title="Start connecting a source">
    Select **Settings** from the left navigation, then open the **Integration** tab.
    Click **Connect a source** in the **Knowledge sources** section and select **Google Drive**.
  </Step>

  <Step title="Choose the connection method">
    Select **Service account**.
  </Step>

  <Step title="Enter connection details">
    Fill in **Admin Account Email (to impersonate)** and **Service Account Email**.
    In the field below them, paste the value of `private_key` from the service account key (JSON file).
    Leave **Enable Google Drive search** on, then click **Save**.
  </Step>

  <Step title="Set what to import">
    On the **Configure Google Drive** screen, set what to import and click **Save Settings** ([Set what to import](#crawl-scope)).
    To set it later, click **Skip for now**.
  </Step>

  <Step title="Start the first sync">
    Click **Start first sync**.
    To run the sync later, click **Skip for now**.
  </Step>

  <Step title="Confirm the connection">
    A Google Drive row appears in the **Knowledge sources** section.
    When the sync finishes, the row's badge shows **Synced**.
  </Step>
</Steps>

<h2 id="crawl-scope">
  Set what to import
</h2>

Set the following on the **Configure Google Drive** screen when you connect.
To change the settings later, click **Edit Config** in the menu (**…**) of the Google Drive row.

1. Select at least one location to import from **My Drive**, **Shared with me**, and **Shared drives**. Only **Shared drives** is selected by default
2. To import only specific shared drives, enter their IDs in **Shared drives — optional**, one ID per line. This field appears when you select **Shared drives**
3. To filter by file type, select MIME types in **Include MIME types — optional** and **Exclude MIME types — optional**. For example, `application/vnd.google-apps.document` or `application/pdf`
4. Click **Save Settings**

<Info>
  * A shared drive ID is the `ID` part of the URL when you open the shared drive (`https://drive.google.com/drive/folders/ID`). The ID starts with "0A"
  * If **Shared drives — optional** is empty, all shared drives are included
  * If you select no MIME types, all supported MIME types are included
  * If the include and exclude settings conflict, the exclude setting takes precedence
  * Files larger than 25 MB are not imported
</Info>

## Using Google Drive with the AI Agent

Once connected, the AI agent includes Google Drive in knowledge searches automatically.

The AI agent does not access Google Drive each time it answers a question. Instead, it searches the content that each sync imports and indexes. Files you add or update in Google Drive appear in search results after the next sync.

By default, the sync schedule is set to **Manual (default)**. With Manual, Google Drive syncs only when you click **Sync Now**. You can find it in the menu (**…**) of the Google Drive row in the **Knowledge sources** section. To sync automatically, open **Sync schedule** in the same menu and change it to **Every hour**, **Every 6 hours**, **Daily**, or **Weekly**. You need the AI Helpdesk **Admin** role to run a sync or change the sync schedule.

To explicitly reference Google Drive in a Playbook step, use the `{{document_search}}` tool.

```markdown theme={null}
### Step 2: Search internal documents

Use {{document_search}} to find relevant procedures.
Include the IT team's shared drive in Google Drive in the search.
```

## Check the sync history

To open the sync history, click the badge that shows the sync status of the Google Drive row (such as **Synced**). You can also click **Sync history** in the row's menu (**…**).
For what each count in the sync history means, see "[Read the sync history](/en/ai-helpdesk/integrations/confluence#sync-history)" in Confluence integration.

## Disconnect Google Drive

<Steps>
  <Step title="Open Knowledge sources">
    Go to **Settings** > **Integration** tab and open the **Knowledge sources** section.
  </Step>

  <Step title="Disconnect">
    Click **Disconnect** in the menu (**…**) of the Google Drive row you want to disconnect.
    In the confirmation dialog, click **Disconnect**.

    For 5 seconds after you click the button in the dialog, you can click **Undo** in the notification to cancel the disconnection.

    <Warning>
      After disconnecting, the AI agent will no longer search Google Drive.
    </Warning>
  </Step>
</Steps>

Disconnecting does not remove the Google Cloud service account or the Domain-Wide Delegation settings. If you no longer need them, delete them on the Google side.

## Troubleshooting

**The row's badge shows "Connection broken" or "Sync failed"**

Check the error in the sync history. If the problem is related to authentication, check the roles of the admin user and the Domain-Wide Delegation settings. If you created a new service account key, enter the connection details again from **Edit credential** in the row's menu (**…**).

<Info>
  When you save from **Edit credential**, you need to enter the private key (the value of `private_key`) again.
</Info>

**Certain files do not appear in search results**

AI Helpdesk imports only files in the locations you selected (**My Drive**, **Shared with me**, **Shared drives**). If you set **Shared drives — optional** or the MIME type filters, only files that match those conditions are imported. Check the settings from **Edit Config** in the row's menu (**…**).

## Related pages

* [AI Helpdesk integrations overview](/en/ai-helpdesk/integrations/index)
* [Confluence integration](/en/ai-helpdesk/integrations/confluence)
* [Add knowledge](/en/ai-helpdesk/knowledge/adding)
* [Register playbooks](/en/ai-helpdesk/playbooks/creating)


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