askill
google-drive

google-driveSafety 85Repository

Search and read Google Drive files including Docs, Sheets, and other documents.

0 stars
1.2k downloads
Updated 2/5/2026

Package Files

Loading files...
SKILL.md

Google Drive Integration

This skill provides access to Google Drive and Google Docs/Sheets/Slides via the Drive API.

Setup Required

Uses OAuth with persistent refresh token (same setup for Calendar, Gmail, Drive).

One-time setup:

google-oauth-setup <path-to-client-secret.json>

See claude/skills/SETUP.md for detailed OAuth setup instructions.

Get Access Token (auto-refreshes):

ACCESS_TOKEN=$(google-oauth-token)

Required header for all requests:

-H "x-goog-user-project: ${GOOGLE_QUOTA_PROJECT}"

When to Use

Use this skill when the user:

  • Asks about Google Drive files or documents
  • Wants to search for a document
  • Needs to read content from a Google Doc or Sheet
  • Asks about recent files
  • Mentions "Drive", "Google Docs", or "Google Sheets"

API Endpoints

Drive API (files, search)

Base URL: https://www.googleapis.com/drive/v3

List Recent Files:

curl -s "https://www.googleapis.com/drive/v3/files?pageSize=20&orderBy=modifiedTime%20desc" \
  -H "Authorization: Bearer ${ACCESS_TOKEN}" | jq '.files[] | {name, id, mimeType}'

Search Files:

curl -s -G "https://www.googleapis.com/drive/v3/files" \
  --data-urlencode "q=name contains 'meeting notes'" \
  --data-urlencode "pageSize=20" \
  -H "Authorization: Bearer ${ACCESS_TOKEN}"

Get File Metadata:

curl -s "https://www.googleapis.com/drive/v3/files/{FILE_ID}?fields=*" \
  -H "Authorization: Bearer ${ACCESS_TOKEN}"

Export Google Doc as Text:

curl -s "https://www.googleapis.com/drive/v3/files/{FILE_ID}/export?mimeType=text/plain" \
  -H "Authorization: Bearer ${ACCESS_TOKEN}"

Docs API (read document content)

Base URL: https://docs.googleapis.com/v1

Get Document Content:

curl -s "https://docs.googleapis.com/v1/documents/{DOCUMENT_ID}" \
  -H "Authorization: Bearer ${ACCESS_TOKEN}"

Sheets API (read spreadsheet data)

Base URL: https://sheets.googleapis.com/v4

Get Spreadsheet Metadata:

curl -s "https://sheets.googleapis.com/v4/spreadsheets/{SPREADSHEET_ID}" \
  -H "Authorization: Bearer ${ACCESS_TOKEN}"

Read Sheet Values:

curl -s "https://sheets.googleapis.com/v4/spreadsheets/{SPREADSHEET_ID}/values/{RANGE}" \
  -H "Authorization: Bearer ${ACCESS_TOKEN}"
# Example RANGE: Sheet1!A1:D10, or just A1:D10 for first sheet

Search Query Syntax

The q parameter uses Drive search syntax:

QueryDescription
name contains 'report'Name contains text
name = 'Exact Name'Exact name match
fullText contains 'search term'Content contains text
mimeType = 'application/vnd.google-apps.document'Google Docs
mimeType = 'application/vnd.google-apps.spreadsheet'Google Sheets
mimeType = 'application/pdf'PDF files
modifiedTime > '2024-01-01'Modified after date
'folder_id' in parentsFiles in specific folder
starred = trueStarred files
trashed = falseNot in trash

Combine with and/or: name contains 'meeting' and mimeType = 'application/vnd.google-apps.document'

MIME Types

TypeMIME Type
Google Docapplication/vnd.google-apps.document
Google Sheetapplication/vnd.google-apps.spreadsheet
Google Slidesapplication/vnd.google-apps.presentation
Google Formapplication/vnd.google-apps.form
Folderapplication/vnd.google-apps.folder

Common Workflows

Search for a Document

ACCESS_TOKEN=$(google-oauth-token)

curl -s -G "https://www.googleapis.com/drive/v3/files" \
  --data-urlencode "q=name contains 'project plan' and mimeType = 'application/vnd.google-apps.document'" \
  --data-urlencode "fields=files(id,name,modifiedTime,webViewLink)" \
  -H "Authorization: Bearer ${ACCESS_TOKEN}"

Read a Google Doc

# Export as plain text
DOC_ID="1abc123..."
curl -s "https://www.googleapis.com/drive/v3/files/${DOC_ID}/export?mimeType=text/plain" \
  -H "Authorization: Bearer ${ACCESS_TOKEN}"

Read a Google Sheet

SHEET_ID="1abc123..."
# Get all values from first sheet
curl -s "https://sheets.googleapis.com/v4/spreadsheets/${SHEET_ID}/values/A:Z" \
  -H "Authorization: Bearer ${ACCESS_TOKEN}" | jq '.values'

List Recent Docs

curl -s -G "https://www.googleapis.com/drive/v3/files" \
  --data-urlencode "q=mimeType = 'application/vnd.google-apps.document'" \
  --data-urlencode "orderBy=modifiedTime desc" \
  --data-urlencode "pageSize=10" \
  --data-urlencode "fields=files(id,name,modifiedTime)" \
  -H "Authorization: Bearer ${ACCESS_TOKEN}"

Search File Content

curl -s -G "https://www.googleapis.com/drive/v3/files" \
  --data-urlencode "q=fullText contains 'quarterly review'" \
  --data-urlencode "fields=files(id,name,mimeType,webViewLink)" \
  -H "Authorization: Bearer ${ACCESS_TOKEN}"

Export Formats

Google Docs can be exported to various formats:

OriginalExport MIME Type
Documenttext/plain, text/html, application/pdf, application/vnd.openxmlformats-officedocument.wordprocessingml.document
Spreadsheettext/csv, application/pdf, application/vnd.openxmlformats-officedocument.spreadsheetml.sheet
Presentationapplication/pdf, text/plain

Extracting File IDs from URLs

Google Drive URLs:

  • Doc: https://docs.google.com/document/d/{FILE_ID}/edit
  • Sheet: https://docs.google.com/spreadsheets/d/{FILE_ID}/edit
  • Drive: https://drive.google.com/file/d/{FILE_ID}/view

The FILE_ID is the long alphanumeric string between /d/ and the next /.

Notes

  • Access tokens expire after 1 hour
  • Google Docs exported as text lose formatting
  • For Sheets, specify range to avoid downloading huge datasets
  • fields parameter reduces response size (use for faster queries)
  • Full-text search only works on files owned or shared with you

Install

Download ZIP
Requires askill CLI v1.0+

AI Quality Score

95/100Analyzed 2/11/2026

An exceptionally well-documented skill for Google Drive integration. It provides clear triggers, detailed API endpoint examples using curl, search syntax references, and common workflows. The inclusion of setup instructions and export format tables makes it highly actionable.

85
100
90
98
95

Metadata

Licenseunknown
Version-
Updated2/5/2026
Publishermajiayu000

Tags

apillmsecurity