CtrlK
BlogDocsLog inGet started
Tessl Logo

odyssey4me/google-drive

Upload, download, search, and share files on Google Drive. Create folders and manage permissions. Use when asked to share a file, upload to gdrive, search cloud storage, manage a Drive folder, or organize Google Drive files.

94

Quality

94%

Does it follow best practices?

Impact

Pending

No eval scenarios have been run

Overview
Skills
Evals
Files

drive-queries.mdreferences/

Google Drive Search Query Syntax

This document provides a comprehensive reference for Google Drive search queries used with the files list command.

Basic Syntax

Queries use a simple syntax of field operator value. Multiple conditions can be combined with and or or.

python scripts/google-drive.py files list --query "name contains 'report'"

Operators

OperatorDescriptionApplies To
containsContains substringname, fullText
=Equals exactlyname, mimeType, trashed, starred, etc.
!=Not equalsmimeType, trashed, starred, etc.
<Less thanmodifiedTime, createdTime
<=Less than or equalmodifiedTime, createdTime
>Greater thanmodifiedTime, createdTime
>=Greater than or equalmodifiedTime, createdTime
inValue in collectionparents, owners, writers, readers
hasCollection containsowners, writers, readers

Searchable Fields

Name and Content

FieldDescriptionExample
nameFile namename contains 'budget'
fullTextName + content + descriptionfullText contains 'quarterly'

Note: fullText searches inside documents (Google Docs, PDFs with OCR, etc.).

File Properties

FieldDescriptionExample
mimeTypeMIME typemimeType = 'application/pdf'
trashedIn trashtrashed = false
starredIs starredstarred = true
sharedWithMeShared with mesharedWithMe = true

Dates

FieldDescriptionExample
modifiedTimeLast modifiedmodifiedTime > '2024-01-01T00:00:00'
createdTimeCreated datecreatedTime >= '2024-06-01'
viewedByMeTimeLast viewedviewedByMeTime > '2024-01-01'

Date format: RFC 3339 format (YYYY-MM-DD or YYYY-MM-DDTHH:MM:SS)

Relationships

FieldDescriptionExample
parentsParent folder'folder_id' in parents
ownersFile owners'user@example.com' in owners
writersUsers with write access'user@example.com' in writers
readersUsers with read access'user@example.com' in readers

Common Query Examples

By Name

# Contains substring
--query "name contains 'report'"

# Exact match
--query "name = 'Budget 2024.xlsx'"

# Case-insensitive contains
--query "name contains 'REPORT'"

By Type

# PDF files
--query "mimeType = 'application/pdf'"

# Google Docs
--query "mimeType = 'application/vnd.google-apps.document'"

# Google Sheets
--query "mimeType = 'application/vnd.google-apps.spreadsheet'"

# Folders only
--query "mimeType = 'application/vnd.google-apps.folder'"

# Images
--query "mimeType contains 'image/'"

# Not folders
--query "mimeType != 'application/vnd.google-apps.folder'"

By Date

# Modified this year
--query "modifiedTime > '2024-01-01'"

# Modified in the last 7 days
--query "modifiedTime > '2024-01-17'"

# Created between dates
--query "createdTime >= '2024-01-01' and createdTime < '2024-02-01'"

# Recently viewed
--query "viewedByMeTime > '2024-01-01'"

By Location

# Files in a specific folder
--query "'FOLDER_ID' in parents"

# Files in root folder
--query "'root' in parents"

# Exclude trashed files
--query "'FOLDER_ID' in parents and trashed = false"

By Sharing

# Files shared with me
--query "sharedWithMe = true"

# Files I own
--query "'me' in owners"

# Files shared with specific user
--query "'user@example.com' in writers"

Combined Queries

# PDFs modified this year
--query "mimeType = 'application/pdf' and modifiedTime > '2024-01-01'"

# Spreadsheets containing 'budget'
--query "name contains 'budget' and mimeType = 'application/vnd.google-apps.spreadsheet'"

# Files in folder, not trashed
--query "'FOLDER_ID' in parents and trashed = false"

# Starred PDFs
--query "starred = true and mimeType = 'application/pdf'"

# Recent documents shared with me
--query "sharedWithMe = true and modifiedTime > '2024-01-01'"

Using OR

# PDFs or Word documents
--query "mimeType = 'application/pdf' or mimeType = 'application/vnd.openxmlformats-officedocument.wordprocessingml.document'"

# Files containing 'report' or 'summary'
--query "name contains 'report' or name contains 'summary'"

Full Text Search

# Search inside documents
--query "fullText contains 'quarterly earnings'"

# Combine with type filter
--query "fullText contains 'project plan' and mimeType = 'application/vnd.google-apps.document'"

MIME Type Reference

Google Workspace Types

TypeMIME Type
Folderapplication/vnd.google-apps.folder
Documentapplication/vnd.google-apps.document
Spreadsheetapplication/vnd.google-apps.spreadsheet
Presentationapplication/vnd.google-apps.presentation
Formapplication/vnd.google-apps.form
Drawingapplication/vnd.google-apps.drawing
Siteapplication/vnd.google-apps.site
Shortcutapplication/vnd.google-apps.shortcut

Common File Types

TypeMIME Type
PDFapplication/pdf
Word (.docx)application/vnd.openxmlformats-officedocument.wordprocessingml.document
Word (.doc)application/msword
Excel (.xlsx)application/vnd.openxmlformats-officedocument.spreadsheetml.sheet
Excel (.xls)application/vnd.ms-excel
PowerPoint (.pptx)application/vnd.openxmlformats-officedocument.presentationml.presentation
PowerPoint (.ppt)application/vnd.ms-powerpoint
Plain texttext/plain
CSVtext/csv
HTMLtext/html
JSONapplication/json
ZIPapplication/zip

Image Types

TypeMIME Type
JPEGimage/jpeg
PNGimage/png
GIFimage/gif
WebPimage/webp
SVGimage/svg+xml
BMPimage/bmp

Video Types

TypeMIME Type
MP4video/mp4
AVIvideo/x-msvideo
MOVvideo/quicktime
WebMvideo/webm

Audio Types

TypeMIME Type
MP3audio/mpeg
WAVaudio/wav
OGGaudio/ogg
M4Aaudio/mp4

Order By Options

When listing files, you can specify the sort order:

OrderDescription
modifiedTime descMost recently modified first (default)
modifiedTimeOldest modified first
createdTime descMost recently created first
nameAlphabetical by name
name descReverse alphabetical
folder,modifiedTime descFolders first, then by modified time
quotaBytesUsed descLargest files first
python scripts/google-drive.py files list --order-by "name"
python scripts/google-drive.py files list --order-by "createdTime desc"

Tips

  1. Always exclude trash: Add and trashed = false to avoid finding deleted files

  2. Use specific MIME types: More efficient than searching by extension

  3. Date queries are fast: Use modifiedTime or createdTime for efficient filtering

  4. Full text is slow: fullText contains searches inside documents, which is slower

  5. Escape special characters: Use backslash to escape quotes in names

    --query "name contains 'John\\'s Report'"
  6. Combine for precision: More specific queries return faster results

    --query "mimeType = 'application/pdf' and modifiedTime > '2024-01-01' and trashed = false"

References

  • Google Drive API Query Reference
  • Drive API MIME Types

Install with Tessl CLI

npx tessl i odyssey4me/google-drive@0.1.2

references

api-reference.md

command-reference.md

drive-queries.md

permissions.md

SKILL.md

tile.json