| name | gws-drive |
| description | Google Drive CLI operations via gws. Use when users need to list, search, upload, download, manage files/folders, permissions, approvals, revisions, comments, shared drives, and more. Triggers: drive, files, upload, download, folders, google drive, file management, permissions, approvals, share, shared drives. |
| metadata | {"short-description":"Google Drive CLI operations","compatibility":"claude-code, codex-cli"} |
Google Drive (gws drive)
gws drive provides CLI access to Google Drive with structured JSON output.
Disclaimer: gws is not the official Google CLI. This is an independent, open-source project not endorsed by or affiliated with Google.
Dependency Check
Before executing any gws command, verify the CLI is installed:
gws version
If not found, install: go install github.com/omriariav/workspace-cli/cmd/gws@latest
Authentication
Requires OAuth2 credentials. Run gws auth status to check.
If not authenticated: gws auth login (opens browser for OAuth consent).
For initial setup, see the gws-auth skill.
Quick Command Reference
Files & Folders
| Task | Command |
|---|
| List files | gws drive list |
| List files in folder | gws drive list --folder <folder-id> |
| Search files | gws drive search "quarterly report" |
| Get file info | gws drive info <file-id> |
| Download a file | gws drive download <file-id> |
| Upload a file | gws drive upload report.pdf |
| Create a folder | gws drive create-folder --name "Project Files" |
| Move a file | gws drive move <file-id> --to <folder-id> |
| Delete a file | gws drive delete <file-id> |
| Copy a file | gws drive copy <file-id> |
| Convert Office file | gws drive convert <file-id> |
| Export file | gws drive export --file-id <id> --mime-type application/pdf --output report.pdf |
| Update metadata | gws drive update --file-id <id> --name "New Name" |
| Empty trash | gws drive empty-trash |
| Drive info | gws drive about |
| Recent changes | gws drive changes |
Permissions
| Task | Command |
|---|
| List permissions | gws drive permissions --file-id <id> |
| Share with user | gws drive share --file-id <id> --type user --role writer --email user@example.com |
| Share with anyone | gws drive share --file-id <id> --type anyone --role reader |
| Get permission | gws drive permission --file-id <id> --permission-id <perm-id> |
| Update permission | gws drive update-permission --file-id <id> --permission-id <perm-id> --role reader |
| Remove permission | gws drive unshare --file-id <id> --permission-id <perm-id> |
Comments & Replies
| Task | Command |
|---|
| List comments | gws drive comments <file-id> |
| Get comment | gws drive comment --file-id <id> --comment-id <cid> |
| Add comment | gws drive add-comment --file-id <id> --content "Great work!" |
| Delete comment | gws drive delete-comment --file-id <id> --comment-id <cid> |
| Resolve comment | gws drive resolve-comment --file-id <id> --comment-id <cid> |
| Unresolve comment | gws drive unresolve-comment --file-id <id> --comment-id <cid> |
| List replies | gws drive replies --file-id <id> --comment-id <cid> |
| Reply to comment | gws drive reply --file-id <id> --comment-id <cid> --content "Thanks!" |
| Get reply | gws drive get-reply --file-id <id> --comment-id <cid> --reply-id <rid> |
| Delete reply | gws drive delete-reply --file-id <id> --comment-id <cid> --reply-id <rid> |
Approvals
| Task | Command |
|---|
| List approvals | gws drive approvals <file-id> |
| Get approval | gws drive approval <file-id> <approval-id> |
| Start approval | gws drive start-approval --file-id <id> --reviewers reviewer@example.com |
| Approve | gws drive approve --file-id <id> --approval-id <approval-id> |
| Decline | gws drive decline --file-id <id> --approval-id <approval-id> |
| Reassign reviewers | gws drive reassign-approval --file-id <id> --approval-id <approval-id> --add-reviewer reviewer@example.com |
| Cancel approval | gws drive cancel-approval --file-id <id> --approval-id <approval-id> |
| Comment on approval | gws drive comment-approval --file-id <id> --approval-id <approval-id> --message "Looks good" |
Revisions
| Task | Command |
|---|
| List revisions | gws drive revisions --file-id <id> |
| Get revision | gws drive revision --file-id <id> --revision-id <rid> |
| Delete revision | gws drive delete-revision --file-id <id> --revision-id <rid> |
Shared Drives
| Task | Command |
|---|
| List shared drives | gws drive shared-drives |
| Get shared drive | gws drive shared-drive --id <drive-id> |
| Create shared drive | gws drive create-drive --name "Engineering" |
| Update shared drive | gws drive update-drive --id <drive-id> --name "New Name" |
| Delete shared drive | gws drive delete-drive --id <drive-id> |
Detailed Usage
list โ List files
gws drive list [flags]
Flags:
--folder string โ Folder ID to list (default: "root")
--max int โ Maximum number of files (default 50)
--order string โ Sort order (default: "modifiedTime desc")
Examples:
gws drive list
gws drive list --folder 1abc123xyz --max 20
gws drive list --order "name"
search โ Search for files
gws drive search <query> [flags]
Flags:
--max int โ Maximum number of results (default 50)
--raw โ Treat query as raw V3 query syntax
Examples:
gws drive search "quarterly report"
gws drive search "budget 2024" --max 10
gws drive search "mimeType='application/pdf' and trashed=false" --raw
info โ Get file info
gws drive info <file-id>
Gets detailed information about a file including name, type, size, owners, and permissions.
download โ Download a file
gws drive download <file-id> [flags]
Flags:
--output string โ Output file path (default: original filename)
Examples:
gws drive download 1abc123xyz
gws drive download 1abc123xyz --output ./local-copy.pdf
upload โ Upload a file
gws drive upload <local-file> [flags]
Flags:
--folder string โ Parent folder ID (default: root)
--name string โ File name in Drive (default: local filename)
--mime-type string โ MIME type (auto-detected if not specified)
create-folder โ Create a new folder
gws drive create-folder --name <name> [flags]
Flags:
--name string โ Folder name (required)
--parent string โ Parent folder ID (default: root)
move โ Move a file
gws drive move <file-id> --to <folder-id>
delete โ Delete a file
gws drive delete <file-id> [flags]
By default, moves to trash. Use --permanent to permanently delete.
copy โ Copy a file
gws drive copy <file-id> [flags]
Flags:
--name string โ Name for the copy
--folder string โ Destination folder ID
convert โ Convert Office file to Google format
gws drive convert <file-id> [flags]
Converts DOCX/XLSX/PPTX to native Google Docs/Sheets/Slides. Creates a new file (does not modify the original). Target format is auto-detected from source MIME type.
Flags:
--name string โ Name for the converted file (default: original name)
--folder string โ Destination folder ID
--to string โ Target format: docs, sheets, slides (auto-detected if omitted)
export โ Export a Google Workspace file
gws drive export --file-id <id> --mime-type <mime> --output <path>
Exports Docs, Sheets, Slides to formats like PDF, CSV, DOCX, etc.
Flags:
--file-id string โ File ID (required)
--mime-type string โ Export MIME type (required, e.g. application/pdf, text/csv)
--output string โ Output file path (required)
update โ Update file metadata
gws drive update --file-id <id> [flags]
Flags:
--file-id string โ File ID (required)
--name string โ New file name
--description string โ New description
--starred โ Star or unstar the file
--trashed โ Trash or untrash the file
empty-trash โ Empty trash
gws drive empty-trash
Permanently deletes all files in the trash. Cannot be undone.
about โ Drive storage and user info
gws drive about
Returns user info and storage quota (limit, usage, usage in Drive, usage in trash).
changes โ List recent file changes
gws drive changes [flags]
Polling pattern: the first call (without --page-token) fetches the current start token
and typically returns zero results. Save the returned new_start_page_token and pass it
in subsequent calls to detect new changes.
Flags:
--max int โ Maximum number of changes (default 100)
--page-token string โ Page token from a previous call (auto-fetches start token if empty)
permissions โ List permissions
gws drive permissions --file-id <id>
share โ Share a file
gws drive share --file-id <id> --type <type> --role <role> [flags]
Flags:
--file-id string โ File ID (required)
--type string โ Permission type: user, group, domain, anyone (required)
--role string โ Role: reader, commenter, writer, organizer, owner (required)
--email string โ Email address (for user/group type)
--domain string โ Domain (for domain type)
--send-notification โ Send notification email (default: true)
unshare โ Remove a permission
gws drive unshare --file-id <id> --permission-id <perm-id>
permission โ Get permission details
gws drive permission --file-id <id> --permission-id <perm-id>
update-permission โ Update a permission
gws drive update-permission --file-id <id> --permission-id <perm-id> --role <role>
comments โ List comments
gws drive comments <file-id> [flags]
Flags:
--max int โ Maximum number of comments (default 100)
--include-resolved โ Include resolved comments
--include-deleted โ Include deleted comments
comment โ Get a single comment
gws drive comment --file-id <id> --comment-id <cid>
add-comment โ Add a comment
gws drive add-comment --file-id <id> --content "comment text"
gws drive add-comment --file-id <id> --content "Fix this" --quoted-text "the text to anchor to"
Flags:
--file-id string โ File ID (required)
--content string โ Comment content (required)
--quoted-text string โ Anchor comment to this quoted text in the document
delete-comment โ Delete a comment
gws drive delete-comment --file-id <id> --comment-id <cid>
resolve-comment โ Resolve a comment
Posts a reply with action=resolve (the documented Drive API path for state
transitions). The original comment content is never modified. Pass an
optional --content to attach a closing note.
gws drive resolve-comment --file-id <id> --comment-id <cid>
gws drive resolve-comment --file-id <id> --comment-id <cid> --content "fixed in #1234"
unresolve-comment โ Reopen a resolved comment
Posts a reply with action=reopen. The original comment content is never
modified. Pass an optional --content to attach a reopening note.
gws drive unresolve-comment --file-id <id> --comment-id <cid>
gws drive unresolve-comment --file-id <id> --comment-id <cid> --content "still broken on safari"
replies โ List replies
gws drive replies --file-id <id> --comment-id <cid>
reply โ Create a reply
gws drive reply --file-id <id> --comment-id <cid> --content "reply text"
get-reply โ Get a reply
gws drive get-reply --file-id <id> --comment-id <cid> --reply-id <rid>
delete-reply โ Delete a reply
gws drive delete-reply --file-id <id> --comment-id <cid> --reply-id <rid>
approvals โ List file approvals
gws drive approvals <file-id> [flags]
Flags:
--max int โ Maximum number of approvals (default 100)
approval โ Get an approval
gws drive approval <file-id> <approval-id>
start-approval โ Start an approval workflow
gws drive start-approval --file-id <id> --reviewers reviewer@example.com [flags]
Flags:
--file-id string โ File ID (required)
--reviewers string โ Comma-separated reviewer email addresses (required)
--due-time string โ Approval due time (RFC3339)
--message string โ Message to send to reviewers
--lock-file โ Lock the file while approval is in progress
approve โ Approve a file approval
gws drive approve --file-id <id> --approval-id <approval-id> [--message "Approved"]
decline โ Decline a file approval
gws drive decline --file-id <id> --approval-id <approval-id> [--message "Needs changes"]
reassign-approval โ Reassign approval reviewers
gws drive reassign-approval --file-id <id> --approval-id <approval-id> --add-reviewer new@example.com
gws drive reassign-approval --file-id <id> --approval-id <approval-id> --replace-reviewer old@example.com=new@example.com
Flags:
--add-reviewer string โ Comma-separated reviewer emails to add
--replace-reviewer string โ Comma-separated replacements in old@example.com=new@example.com form
--message string โ Message to send to reviewers
cancel-approval โ Cancel an approval
gws drive cancel-approval --file-id <id> --approval-id <approval-id> [--message "Cancelling"]
comment-approval โ Comment on an approval
gws drive comment-approval --file-id <id> --approval-id <approval-id> --message "Please review"
revisions โ List revisions
gws drive revisions --file-id <id>
revision โ Get revision details
gws drive revision --file-id <id> --revision-id <rid>
delete-revision โ Delete a revision
gws drive delete-revision --file-id <id> --revision-id <rid>
shared-drives โ List shared drives
gws drive shared-drives [flags]
Flags:
--max int โ Maximum number of drives (default 100)
--query string โ Search query
shared-drive โ Get shared drive info
gws drive shared-drive --id <drive-id>
create-drive โ Create a shared drive
gws drive create-drive --name "Drive Name"
update-drive โ Update a shared drive
gws drive update-drive --id <drive-id> --name "New Name"
delete-drive โ Delete a shared drive
gws drive delete-drive --id <drive-id>
Output Modes
gws drive list --format json
gws drive list --format yaml
gws drive list --format text
Tips for AI Agents
- Always use
--format json (the default) for programmatic parsing
- Use
gws drive search to find files by name, then gws drive info <id> for details
- File IDs from Google Docs/Sheets/Slides URLs can be extracted from the URL path
- Delete moves to trash by default โ use
--permanent only when explicitly requested
- When uploading, MIME type is auto-detected from the file extension
- The
comments command works on any Drive file type (Docs, Sheets, Slides, etc.)
- Resolved comments are excluded by default; use
--include-resolved to see them
- Use
gws drive about to check storage quota before large uploads
- Use
gws drive changes to monitor recent file activity
- For sharing, use
--type anyone --role reader for public access
- For Workspace file exports, common MIME types:
application/pdf, text/csv, application/vnd.openxmlformats-officedocument.wordprocessingml.document