Skills & Plugins Productivity Skills

OpenClaw Google Drive: The Automatic File Management Agent Setup

Connect OpenClaw to Google Drive to automate file creation, folder organization, document reading, and storage workflows. Full OAuth setup with config examples and workflow patterns.

TC
T. Chen
Productivity Workflow Engineer
2025-02-03 15 min 8.6k views
Updated Mar 2025
Key Takeaways
  • The Google Drive skill uses OAuth 2.0 — run openclaw gateway gdrive auth to complete the one-time setup
  • Request drive.file scope for most workflows — it's the minimum necessary and keeps your OAuth approval fast
  • Create, read, update, move, and share files across My Drive and Shared Drives
  • Folder watching via push notifications lets your agent react to new uploads automatically
  • Pair with the Summarize skill to automatically process new documents as they arrive

Most teams waste hours every week on file management that should be automated. Creating reports from templates, organizing incoming uploads, sharing completed documents with the right people — these are rote tasks that follow predictable rules. OpenClaw's Google Drive skill handles all of it. Connect once, define your rules, and watch the manual work disappear. Here's exactly how to set it up and what it can do.

What You Can Automate

The Google Drive skill gives your OpenClaw agents full read/write access to your Drive storage. The operations that generate the most value immediately:

  • Automated document creation — generate reports, briefs, summaries, and templates as Google Docs based on triggers from other systems
  • Folder organization — move files to the right folder based on content classification, date, or metadata
  • Document ingestion — read files from Drive and pass their contents to your agent for analysis, summarization, or processing
  • Sharing automation — share completed documents with stakeholders automatically based on workflow rules
  • Change detection — watch specific folders and trigger workflows when new files arrive

The most impactful single workflow we see across teams: new file lands in an "Inbox" folder → agent reads and classifies it → agent renames it with a standardized name → agent moves it to the correct subfolder → agent sends a Slack notification with a summary and link. This alone eliminates 20–30 minutes of daily file wrangling for teams with active document inflows.

OAuth Setup

The Google Drive skill uses OAuth 2.0 with a service account for server-side automation or user OAuth for personal Drive access.

For most team deployments, use a service account: create one in Google Cloud Console, download the JSON credentials, and grant it access to the specific folders it needs by sharing those folders with the service account email address (it looks like name@project.iam.gserviceaccount.com).

For personal Drive workflows, run openclaw gateway gdrive auth to trigger the OAuth browser flow. Your tokens are stored encrypted and refresh automatically.

# ~/.openclaw/config.yaml — Google Drive skill
skills:
  google_drive:
    enabled: true

    # Service account (recommended for team workflows)
    credentials_file: "${GDRIVE_CREDENTIALS_JSON}"

    # OR user OAuth (for personal Drive)
    # oauth_token: "${GDRIVE_OAUTH_TOKEN}"

    # Default folder for new files
    default_folder_id: "YOUR_FOLDER_ID"

    # Shared Drive support
    supports_all_drives: true

    # Webhook for folder watching (optional)
    webhook:
      enabled: false
      url: "https://yourdomain.com/openclaw/gdrive/webhook"
      watched_folders:
        - "INBOX_FOLDER_ID"
💡
Find Folder IDs

Open the folder in Google Drive. The ID is the last part of the URL: drive.google.com/drive/folders/THIS_PART_IS_THE_ID. Copy it and use it in your config. For Shared Drives, the drive ID is in the same location.

Config Reference

Key configuration options beyond the basics:

  • default_folder_id — where new files go unless your workflow specifies otherwise. Set this to your primary working folder.
  • supports_all_drives — must be true to access Shared Drives (Team Drives). False by default for security.
  • file_name_template — define a naming pattern for auto-created files. Supports date tokens like {date}, {year}, {month} and custom variables from your workflow context.
  • overwrite_existing — when true, writing to an existing file path updates it in place. When false (default), creates a new file with a numeric suffix.

File Creation Workflows

Creating a Google Doc from your agent is straightforward. The skill handles the API calls, formatting, and folder placement based on your workflow definition.

A meeting notes workflow looks like this: meeting transcript arrives as text → agent processes it → agent calls the Drive skill to create a new Google Doc in your "Meeting Notes/2025" folder → doc is pre-populated with the meeting summary, action items, and attendees → agent shares it with all meeting participants via their Google accounts → posts a link to Slack.

The entire flow runs in 10–20 seconds from transcript receipt to shared document. Teams running this report saving 5–15 minutes per meeting in manual note distribution.

⚠️
Scope Creep Risk

Google Cloud OAuth scopes are permanent until you explicitly revoke them. Start with drive.file (narrowest scope) and only expand to drive.readonly or drive (full access) when you have confirmed your workflow needs it. Auditors will flag overly broad OAuth scopes in security reviews.

Search and Read Operations

The Drive skill can search files by name, type, modified date, or custom metadata. Use this to build workflows that find and process relevant documents automatically.

Searching for all PDF files modified in the last 7 days, passing their contents to the Summarize skill, and posting weekly document summaries to your team Slack is a common monitoring workflow. The Drive search query syntax follows Google Drive's own query format: mimeType='application/pdf' and modifiedTime > 'DATE'.

Reading file content works differently by file type. Google Docs export to plain text or markdown. Spreadsheets export to CSV. Binary files (PDFs, images) require the appropriate skill for content extraction. Always specify the export format in your workflow to avoid getting raw API binary responses.

Common Mistakes

Sharing with the service account email rather than the folder is a frequent setup error. The service account needs to be a collaborator on the specific folders it should access. If your workflow returns "insufficient permissions," check that you shared the right folder with the service account email, not just the general Drive.

Not handling duplicate file names causes clutter over time. Set a consistent file_name_template that includes a timestamp or unique identifier. This prevents the agent from creating "Report (1).docx", "Report (2).docx" etc. when the same workflow runs multiple times.

Frequently Asked Questions

What permissions does OpenClaw need on Google Drive?

For most workflows, request drive.file scope — access only to files the app creates or opens. For reading existing files not created by the app, add drive.readonly. Avoid full drive scope unless your workflow genuinely needs to access the entire Drive. Narrower scopes pass security reviews faster.

Can OpenClaw create Google Docs, Sheets, and Slides?

Yes. Specify the mimeType when creating files: application/vnd.google-apps.document for Docs, application/vnd.google-apps.spreadsheet for Sheets, application/vnd.google-apps.presentation for Slides. The skill creates an empty file and then writes content to it in a second API call.

How do I share a file OpenClaw creates?

After creating a file, use the share action in your workflow with the target email and role (reader, writer, or commenter). OpenClaw sends the sharing invitation via the Drive API. For public sharing, set role to reader and type to anyone.

Can OpenClaw watch a folder for new files?

Yes, using Drive push notifications. Configure a webhook URL in your skill config and OpenClaw will register a watch on the specified folders. Your agent fires whenever a file is added, modified, or deleted. Requires a public HTTPS endpoint for the webhook receiver.

What file size limits apply?

The Google Drive API handles uploads up to 5TB. For reading file content into agent context, practical limits are your model's context window size. Enable chunk_mode in the skill config for large documents to process them in segments rather than loading the entire file at once.

Does OpenClaw support Shared Drives?

Yes. Add supportsAllDrives: true in your config and specify the driveId when targeting Shared Drives. Without this flag, the skill only accesses personal My Drive files. This setting is required for any organization using Shared Drives as their primary storage structure.

TC
T. Chen
Productivity Workflow Engineer · aiagentsguides.com

T. Chen designs document automation workflows for engineering and operations teams. Every integration in his guides has been validated in real production environments.

Get new guides every week.

Join 50,000 OpenClaw users. No spam, ever.