SuperAPI AI Directory

gdrive

General & other

View repository

Updated 10-15 21:03

About this skill

Google Drive Operations Skill (gog v0.10.0)

Operate Google Drive with the gog CLI.

Execution path: gog

Authenticated account: (account authenticated with gog)

Execution Notes

  • exec When running with the tool,timeout: 60 specify
  • For uploading/downloading large files, timeout: 300 is recommended

File list

Root folder

gog drive ls
gog drive ls --max 20

Specific folder

gog drive ls --parent <folderId>

Detailed output

gog drive ls --json

File search

Text search

gog drive search "レポート"
gog drive search "プロジェクト計画"

Advanced search (Drive query syntax)

# ファイルタイプで絞り込み
gog drive search "mimeType='application/pdf'"
gog drive search "mimeType='application/vnd.google-apps.spreadsheet'"
gog drive search "mimeType='application/vnd.google-apps.document'"

# 特定フォルダ内
gog drive search "name contains '請求書' and '<folderId>' in parents"

# 所有者
gog drive search "name contains 'report' and 'user@example.com' in owners"

MIME type list

Type MIME type
PDF application/pdf
Google Sheets application/vnd.google-apps.spreadsheet
Google Docs application/vnd.google-apps.document
Google Slides application/vnd.google-apps.presentation
Folder application/vnd.google-apps.folder
Image image/jpeg, image/png
Word application/vnd.openxmlformats-officedocument.wordprocessingml.document
Excel application/vnd.openxmlformats-officedocument.spreadsheetml.sheet

File operations

Get metadata

gog drive get <fileId>

Download

gog drive download <fileId>
gog drive download <fileId> --output "./local-file.pdf"

Google Docs export

# スプレッドシート → CSV
gog drive download <spreadsheetId> --export-format csv

# ドキュメント → PDF
gog drive download <docId> --export-format pdf

# スライド → PPTX
gog drive download <slideId> --export-format pptx

Upload

gog drive upload "./local-file.pdf"
gog drive upload "./file.xlsx" --parent <folderId>

Copy

gog drive copy <fileId> "コピー名"
gog drive copy <fileId> "コピー名" --parent <folderId>

Move

gog drive move <fileId> --parent <newFolderId>

Rename

gog drive rename <fileId> "新しい名前"

Delete

gog drive delete <fileId>
gog drive delete <fileId> --force  # 確認スキップ

Folder operations

Create folder

gog drive mkdir "新しいフォルダ"
gog drive mkdir "サブフォルダ" --parent <parentFolderId>

List in folder

gog drive ls --parent <folderId>

Share

Share settings

# 閲覧者として共有
gog drive share <fileId> --email "user@example.com" --role reader

# 編集者として共有
gog drive share <fileId> --email "user@example.com" --role writer

# コメント権限
gog drive share <fileId> --email "user@example.com" --role commenter

Permission list

gog drive permissions <fileId>

Unshare

gog drive unshare <fileId> <permissionId>

Share role

Role Description
reader View only
commenter Can comment
writer Can edit
owner Owner

Get URL

gog drive url <fileId>
gog drive url <fileId1> <fileId2> <fileId3>

Comment

# コメント一覧
gog drive comments list <fileId>

# コメント追加
gog drive comments add <fileId> --content "コメント内容"

Shared drive

# 共有ドライブ一覧
gog drive drives

Output options

Options Description
--json JSON output
--plain TSV output
--max N Max N items

Typical workflow

Search file → download

# 1. 検索
gog drive search "月次レポート" --json

# 2. ダウンロード
gog drive download <fileId> --output "./月次レポート.pdf"

Create folder → upload → share

# 1. フォルダ作成
RESULT=$(gog drive mkdir "プロジェクトX資料" --json)
FOLDER_ID=$(echo "$RESULT" | jq -r '.id')

# 2. アップロード
gog drive upload "./proposal.pdf" --parent "$FOLDER_ID"

# 3. 共有
gog drive share "$FOLDER_ID" --email "client@example.com" --role reader

# 4. URL取得
gog drive url "$FOLDER_ID"

Download spreadsheet as CSV

gog drive download <spreadsheetId> --export-format csv --output "./data.csv"

How to get FileId

Extract from URL:

  • https://docs.google.com/spreadsheets/d/<ID>/edit → <ID> part
  • https://drive.google.com/file/d/<ID>/view → <ID> part
  • https://docs.google.com/document/d/<ID>/edit → <ID> part

Move to trash

gog drive trash <fileId>

Open in browser

gog open <fileId>           # ブラウザでファイルを開く
gog open <url>              # URLを開く

Top-level download / upload

gog download <fileId>                          # Drive からダウンロード
gog download <fileId> --output "./file.pdf"
gog upload "./local-file.pdf"                  # Drive にアップロード
gog upload "./file.xlsx" --parent <folderId>

gog drive download / gog drive upload shortcut equivalent to .


Notes

  • Trash: delete moves to trash (not permanent deletion)
  • Google format: For Sheets/Docs, specify the export format when downloading
  • Shared drive: --shared-drive option may be required
  • Large files: Set a longer timeout