Loading...
Loading...
Manage Google Drive files and folders. List, search, upload, download files, create folders, and manage sharing. Use when working with Google Drive file management.
npx skill4agent add odyssey4me/agent-skills google-drivepip install --user google-auth google-auth-oauthlib google-api-python-client keyring pyyamlpython scripts/google-drive.py check~/.config/agent-skills/google.yamloauth_client:
client_id: your-client-id.apps.googleusercontent.com
client_secret: your-client-secretpython scripts/google-drive.py check| Scope | Permission | Used For |
|---|---|---|
| Read files and metadata | list, search, download |
| Create/edit files created by app | upload, create folders, share |
| View file metadata only | get file info |
keyring del agent-skills google-drive-token-jsonpython scripts/google-drive.py checkpython scripts/google-drive.py checkpython scripts/google-drive.py auth setup \
--client-id YOUR_CLIENT_ID \
--client-secret YOUR_CLIENT_SECRET~/.config/agent-skills/google-drive.yaml# List recent files
python scripts/google-drive.py files list
# List with search query
python scripts/google-drive.py files list --query "name contains 'report'"
# List with max results
python scripts/google-drive.py files list --max-results 20
# List sorted by name
python scripts/google-drive.py files list --order-by "name"
# Output as JSON
python scripts/google-drive.py files list --json--query--max-results--order-by--json# Search by name
python scripts/google-drive.py files search --name "quarterly report"
# Search by MIME type
python scripts/google-drive.py files search --mime-type "application/pdf"
# Search in a specific folder
python scripts/google-drive.py files search --folder FOLDER_ID
# Combine filters
python scripts/google-drive.py files search --name "budget" --mime-type "application/vnd.google-apps.spreadsheet"
# Output as JSON
python scripts/google-drive.py files search --name "report" --json--name--mime-type--folder--json# Get file details
python scripts/google-drive.py files get FILE_ID
# Output as JSON
python scripts/google-drive.py files get FILE_ID --jsonfile_id--json# Download a file
python scripts/google-drive.py files download FILE_ID --output /path/to/local/file
# Short form
python scripts/google-drive.py files download FILE_ID -o ./downloaded-file.pdffile_id--output-o# Upload a file
python scripts/google-drive.py files upload /path/to/file.pdf
# Upload to a specific folder
python scripts/google-drive.py files upload /path/to/file.pdf --parent FOLDER_ID
# Upload with custom name
python scripts/google-drive.py files upload /path/to/file.pdf --name "Quarterly Report 2024"
# Upload with specific MIME type
python scripts/google-drive.py files upload /path/to/file --mime-type "text/csv"
# Output as JSON
python scripts/google-drive.py files upload /path/to/file.pdf --jsonpath--parent--mime-type--name--json# Create folder in root
python scripts/google-drive.py folders create "New Folder"
# Create folder inside another folder
python scripts/google-drive.py folders create "Subfolder" --parent FOLDER_ID
# Output as JSON
python scripts/google-drive.py folders create "Documents" --jsonname--parent--json# List folder contents
python scripts/google-drive.py folders list FOLDER_ID
# List with max results
python scripts/google-drive.py folders list FOLDER_ID --max-results 50
# Output as JSON
python scripts/google-drive.py folders list FOLDER_ID --jsonfolder_id--max-results--json# Share as reader (default)
python scripts/google-drive.py share FILE_ID --email user@example.com
# Share as writer
python scripts/google-drive.py share FILE_ID --email user@example.com --role writer
# Share as commenter
python scripts/google-drive.py share FILE_ID --email user@example.com --role commenter
# Share without sending notification
python scripts/google-drive.py share FILE_ID --email user@example.com --no-notify
# Output as JSON
python scripts/google-drive.py share FILE_ID --email user@example.com --jsonfile_id--email--role--no-notify--json# List permissions
python scripts/google-drive.py permissions list FILE_ID
# Output as JSON
python scripts/google-drive.py permissions list FILE_ID --jsonfile_id--json# Delete a permission
python scripts/google-drive.py permissions delete FILE_ID PERMISSION_IDfile_idpermission_idpython scripts/google-drive.py checkpython scripts/google-drive.py files list --query "mimeType='application/pdf'" --max-results 5python scripts/google-drive.py files search --name "project proposal"# First, find the file ID
python scripts/google-drive.py files search --name "report.pdf"
# Then download it
python scripts/google-drive.py files download FILE_ID -o ./report.pdf# Upload the file
python scripts/google-drive.py files upload ./presentation.pdf --name "Q4 Presentation"
# Share with a colleague
python scripts/google-drive.py share FILE_ID --email colleague@example.com --role writer# Create a folder
python scripts/google-drive.py folders create "Project Documents"
# Upload files to the folder
python scripts/google-drive.py files upload ./doc1.pdf --parent FOLDER_ID
python scripts/google-drive.py files upload ./doc2.pdf --parent FOLDER_ID
# List folder contents
python scripts/google-drive.py folders list FOLDER_ID| Operator | Description | Example |
|---|---|---|
| Name contains string | |
| Exact name match | |
| File type | |
| In folder | |
| Modified after | |
| Trashed status | |
| Starred status | |
| Shared files | |
andor# PDF files modified this year
"mimeType = 'application/pdf' and modifiedTime > '2024-01-01'"
# Spreadsheets containing 'budget'
"name contains 'budget' and mimeType = 'application/vnd.google-apps.spreadsheet'"
# Files in a specific folder that are not trashed
"'folder_id' in parents and trashed = false"| Type | MIME Type |
|---|---|
| Folder | |
| Google Doc | |
| Google Sheet | |
| Google Slides | |
| |
| Word | |
| Excel | |
| PowerPoint | |
| Text | |
| CSV | |
| Image (JPEG) | |
| Image (PNG) | |
python scripts/google-drive.py check~/.config/agent-skills/google.yamlkeyring del agent-skills google-drive-token-json
python scripts/google-drive.py checkpip install --user google-auth google-auth-oauthlib google-api-python-client keyring pyyamlhttps://www.googleapis.com/auth/drive.readonlyhttps://www.googleapis.com/auth/drive.filehttps://www.googleapis.com/auth/drive.metadata.readonly~/.config/agent-skills/google-drive.yaml