Install
openclaw skills install google-drive-service-accountAccess Google Drive from OpenClaw using either GOOGLE_SERVICE_ACCOUNT_KEY service-account JSON or a GOOGLE_OAUTH_REFRESH_TOKEN from the Google Drive OAuth connector.
openclaw skills install google-drive-service-accountUse this skill when Google Drive access is available through either:
GOOGLE_SERVICE_ACCOUNT_KEY for service-account authGOOGLE_OAUTH_REFRESH_TOKEN for the dashboard Google Drive OAuth connectorOAuth mode also needs GOOGLE_CLIENT_ID and GOOGLE_CLIENT_SECRET so the refresh token can be exchanged for an access token.
This skill is for:
Important behavior:
GOOGLE_OAUTH_REFRESH_TOKEN when present, then falls back to GOOGLE_SERVICE_ACCOUNT_KEY.GOOGLE_DRIVE_SUBJECT=user@company.com or pass --subject user@company.com.--json.Check access:
python3 {baseDir}/scripts/gdrive_sa.py whoami
Search files:
python3 {baseDir}/scripts/gdrive_sa.py search "name contains 'Q1'" --limit 10
python3 {baseDir}/scripts/gdrive_sa.py search "'root' in parents" --limit 25 --json
List a folder:
python3 {baseDir}/scripts/gdrive_sa.py ls root --limit 50
python3 {baseDir}/scripts/gdrive_sa.py ls <folderId> --json
Inspect metadata:
python3 {baseDir}/scripts/gdrive_sa.py info <fileId>
Download or export:
python3 {baseDir}/scripts/gdrive_sa.py download <fileId> --out /tmp/file.bin
python3 {baseDir}/scripts/gdrive_sa.py export <fileId> --mime text/plain --out /tmp/doc.txt
python3 {baseDir}/scripts/gdrive_sa.py cat <fileId> --mime text/plain
Create folders and upload files:
python3 {baseDir}/scripts/gdrive_sa.py mkdir "Reports" --parent root
python3 {baseDir}/scripts/gdrive_sa.py upload ./report.pdf --parent <folderId>
python3 {baseDir}/scripts/gdrive_sa.py upload ./notes.txt --name "meeting-notes.txt" --parent root
Drive search uses the standard Drive query syntax in the q parameter. Useful examples:
name contains 'invoice'mimeType = 'application/vnd.google-apps.folder''root' in parentstrashed = falsemodifiedTime > '2026-01-01T00:00:00Z'Combined example:
python3 {baseDir}/scripts/gdrive_sa.py search "trashed = false and name contains 'roadmap'" --limit 20 --json
Common export choices for Google-native files:
text/plainapplication/pdfapplication/vnd.openxmlformats-officedocument.wordprocessingml.documenttext/csvapplication/vnd.openxmlformats-officedocument.spreadsheetml.sheetapplication/pdfExample:
python3 {baseDir}/scripts/gdrive_sa.py export <sheetId> --mime text/csv --out /tmp/sheet.csv
supportsAllDrives=true and includeItemsFromAllDrives=true.root refers to the visible root for the authenticated principal.cat only for text-friendly outputs. Use download or export --out for binary files.