> ## Documentation Index
> Fetch the complete documentation index at: https://agno-v2.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# Google Drive

> Search and read files from Google Drive.

Search and read files from Google Drive, including Docs, Sheets, and uploaded files. The provider exposes one tool: `query_gdrive`.

```python theme={null}
from agno.agent import Agent
from agno.context.gdrive import GoogleDriveContextProvider

drive = GoogleDriveContextProvider()

agent = Agent(
    model=...,
    tools=drive.get_tools(),
)

await agent.aprint_response("Find the Q4 planning doc and summarize the key milestones")
```

> [!NOTE]
>
> GoogleDriveContextProvider is **read-only**. There is no `update_gdrive` tool.

## Authentication

OAuth or service account. For service accounts, share folders with the service account email.

**OAuth (Personal)**

```shell theme={null}
export GOOGLE_CLIENT_ID=...
export GOOGLE_CLIENT_SECRET=...
export GOOGLE_PROJECT_ID=...
```

Token cached to `gdrive_token.json`.

**Service Account**

```shell theme={null}
export GOOGLE_SERVICE_ACCOUNT_FILE=/path/to/service-account.json
```

Share folders/files with the service account email to grant access.

## Configuration

| Parameter | Type | Default | Description |
| - | - | - | - |
| `id` | `str` | `"gdrive"` | Tool becomes `query_<id>`. |
| `corpora` | `str` | `"allDrives"` | Search scope: `"user"`, `"domain"`, `"drive"`, or `"allDrives"`. |
| `drive_id` | `str` | `None` | Required when `corpora="drive"` (single Shared Drive). |
| `model` | `Model` | `None` | Model for the sub-agent. |
| `mode` | `ContextMode` | `default` | See [Mode](https://agno-v2.mintlify.site/context-providers/overview.md#mode). |

## Tools Exposed

| Tool | Description |
| - | - |
| `query_gdrive` | Search files, list folders, read file contents (including Google Docs/Sheets). |

## Shared Drive Support

By default, `corpora="allDrives"` searches everything the user can access. Narrow the scope:

```python theme={null}
# Personal Drive only
drive = GoogleDriveContextProvider(corpora="user")

# Single Shared Drive
drive = GoogleDriveContextProvider(corpora="drive", drive_id="0ABcd...")

# All files shared to domain
drive = GoogleDriveContextProvider(corpora="domain")
```

## Example queries

| Query | What happens |
| - | - |
| "Find the product roadmap document" | Searches by title |
| "What spreadsheets were modified this week?" | Searches with time filter |
| "Read the meeting notes from the design review" | Gets file content |

## Resources

> **[GoogleDriveTools Reference](https://agno-v2.mintlify.site/tools/toolkits/others/google-drive.md)**
>
> All methods and OAuth setup

> **[Cookbook Example](https://github.com/agno-agi/agno/blob/main/cookbook/12_context/07_google_drive.py)**
>
> Working example


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