Google Drive

Upload, download, and manage files in Google Drive via the Drive API using curl.

thinkfleetai 07cd0cc 1.2 KB Updated

File contents

Google Drive

File operations via Google Drive API v3.

Environment Variables

  • GOOGLE_ACCESS_TOKEN - OAuth2 access token with drive scope

List files

curl -s -H "Authorization: Bearer $GOOGLE_ACCESS_TOKEN" \
  "https://www.googleapis.com/drive/v3/files?pageSize=10&fields=files(id,name,mimeType,modifiedTime)" \
  | jq '.files[]'

Download a file

curl -s -H "Authorization: Bearer $GOOGLE_ACCESS_TOKEN" \
  "https://www.googleapis.com/drive/v3/files/FILE_ID?alt=media" -o /tmp/downloaded-file

Upload a file

curl -s -X POST \
  -H "Authorization: Bearer $GOOGLE_ACCESS_TOKEN" \
  -F "metadata={\"name\":\"myfile.txt\"};type=application/json;charset=UTF-8" \
  -F "file=@/tmp/myfile.txt" \
  "https://www.googleapis.com/upload/drive/v3/files?uploadType=multipart" \
  | jq '{id, name}'

Search files

curl -s -H "Authorization: Bearer $GOOGLE_ACCESS_TOKEN" \
  "https://www.googleapis.com/drive/v3/files?q=name%20contains%20'report'&fields=files(id,name)" \
  | jq '.files[]'

Notes

  • For large files (>5MB), use resumable upload.
  • Always confirm before deleting files.

thinkfleetai/thinkfleet-engine/tree/main/skills/google-drive commit 07cd0ccde2

Frequently asked questions

npx skillmds@latest add thinkfleetai/google-drive