No slash command · from duckdb-gdrive
Walks through installing the gdrive DuckDB extension, creating secrets with multiple auth providers (credential_chain, service_account, authorization_code, config), and troubleshooting 401/403 errors. Covers DRIVE_ID vs ROOT_FOLDER_ID, DRIVE_SCOPE, and the gcloud scopes trap.
Ships in duckdb-gdrive. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
None: SKILL.md is the whole skill.
INSTALL gdrive FROM community;
LOAD gdrive;
CREATE SECRET (TYPE gdrive); -- credential_chain: your gcloud login
The login must ask for the Drive scope -- gcloud's default (cloud-platform)
does not include it, and every read then fails with 403:
gcloud auth application-default login --scopes=openid,https://www.googleapis.com/auth/drive
| PROVIDER | when | fields |
|---|---|---|
credential_chain (default) | your gcloud login, GOOGLE_APPLICATION_CREDENTIALS, a key file, or workload identity (external_account) -- no arguments | optional; SET gdrive_adc_file = '<path>' overrides discovery |
service_account | unattended jobs | KEY_FILE |
authorization_code | browser consent on this machine, your own Desktop app OAuth client | CLIENT_ID, CLIENT_SECRET, optional REDIRECT_PORT (8020) |
config | a token you already have | ACCESS_TOKEN, or REFRESH_TOKEN + CLIENT_ID + CLIENT_SECRET |
Every provider also takes where gdrive:// paths hang off -- DRIVE_ID for a
Shared Drive (id starts 0A), or ROOT_FOLDER_ID for an ordinary folder
(not interchangeable: a folder id as DRIVE_ID answers 404 "Shared drive not
found") -- and DRIVE_SCOPE (default drive.readonly; use
https://www.googleapis.com/auth/drive to write).
CREATE SECRET sa (TYPE gdrive, PROVIDER service_account, KEY_FILE '/etc/creds/sa.json',
DRIVE_ID '0ABcDeFgHiJkLmNoPQ', DRIVE_SCOPE 'https://www.googleapis.com/auth/drive');
CREATE PERSISTENT SECRET me (TYPE gdrive, PROVIDER authorization_code,
CLIENT_ID '...apps.googleusercontent.com', CLIENT_SECRET '...',
DRIVE_SCOPE 'https://www.googleapis.com/auth/drive');
SELECT name, id FROM gdrive_drives(); -- the Shared Drives the identity is in; id -> DRIVE_ID
Rules that bite:
DRIVE_SCOPE. SCOPE is DuckDB's path-prefix list for
the secret; a scope URL there makes the secret match no gdrive:// path ("no secret
configured").storageQuotaExceeded).DRIVE_SCOPE cannot narrow a refresh token (config, gcloud logins): the scope is
fixed at consent. Only service accounts and authorization_code enforce it.authorization_code keeps the refresh token in the secret: CREATE PERSISTENT SECRET
to survive a restart (DuckDB's secret store, on disk).getenv('...') works in CREATE SECRET.ATTACHed file sees only GLOBAL settings (SET GLOBAL gdrive_...).| error | fix |
|---|---|
403, "insufficient authentication scopes" / ACCESS_TOKEN_SCOPE_INSUFFICIENT | the token lacks the Drive scope: re-run gcloud with --scopes=...auth/drive |
403 insufficientPermissions (no scope detail) | the file is not shared with this identity |
403 storageQuotaExceeded | a service account writing outside a Shared Drive |
| "This app is blocked" in the browser | a Workspace domain blocks gcloud's client for restricted scopes: use a service-account key, have an admin trust the "Google Auth Library" client, or bring your own OAuth client (--client-id-file) |
| "requires a quota project" | the gcloud ADC file has no quota_project_id: gcloud auth application-default set-quota-project <project> |
| 404 "Shared drive not found" | a folder id passed as DRIVE_ID: use ROOT_FOLDER_ID |
'...' is ambiguous: N files share that name | Drive allows duplicate names; use the gdrive://id:<fileId> the error names |
gdrive_permanent_delete (false: removals go to the trash), gdrive_docs_export_mime
(text/plain), gdrive_block_size_bytes (16 MiB), gdrive_block_cache_bytes (256 MiB),
gdrive_upload_chunk_bytes (16 MiB), gdrive_path_cache_entries (4096),
gdrive_immutable_prefixes, gdrive_adc_file, gdrive_telemetry_enabled.
SELECT * FROM gdrive_stats() (Drive API calls by kind, cache hits, retries),
CALL gdrive_reset_stats(), SELECT gdrive_version(). GDRIVE_TRACE_FILE=<path>
writes one JSON line per API call.
What SKILL.md sets; muted values are Claude Code's defaults
Three short reads, in order
npx claudepluginhub datazoode/duckdb-gdrive --plugin duckdb-gdrive4 skills in this plugin
/gdrive-filesFiles in Google Drive with the gdrive DuckDB extension: the gdrive:// filesystem (paths relative to the secret's root, the id: form, globs with * ? [a-z] ** {a,b}, duplicate-name errors), browser addresses pasted as paths (drive.google.com/file/d/..., docs.google.com/spreadsheets/d/..., folders), reading Parquet/CSV/JSON/anything through it, native Google Sheets and Docs (exported as CSV / text), COPY TO (streamed, appears on close), write_blob / remove_file / move_file / file_size, ATTACH of a .duckdb file (read-only), DuckLake with DATA_PATH on Drive, and the concurrency limits (no atomic create: concurrent writers duplicate). Use when reading or writing files in Google Drive from SQL, querying a Sheet, putting a lakehouse on Drive, or when the user pastes a Drive or Sheets link.
/gdrive-metadataGoogle Drive's metadata as tables with the gdrive DuckDB extension: read_gdrive_files (files under a path, glob or folder with owner, last modifier, size, md5, web_url, revision, custom properties, lock), search_gdrive (Drive's full-text search; hits read back by id), gdrive_drives (Shared Drives and their ids), gdrive_versions and the ?version= path form (read an earlier revision with any reader), gdrive_changes (what changed under a folder since a token -- the mirror / incremental-sync pattern), and gdrive_permissions (who can reach what: direct, inherited, anyone-with-link, domain). Use when listing or inventorying Drive, finding a file, reading an old version, syncing a folder incrementally, or auditing sharing.
/gdrive-sheetsGoogle Sheets by tab and A1 range with the gdrive DuckDB extension: read_sheet_range(path, 'Tab!A1:F' [, header, all_varchar]) reads any tab or range, typed (dates, booleans, formula results); COPY ... TO '<Sheet>' (FORMAT sheet_range, RANGE 'Tab!A1' [, HEADER b] [, OVERWRITE | APPEND] [, CREATE b]) writes into a tab in place through the Sheets API (missing tab created, other tabs and formats kept), and creates a new native Sheet when a gdrive:// path names nothing. Covers A1 forms and quoting ('My Tab'!A1), OVERWRITE vs APPEND vs the default block write, atomicity and the 2 MB split, value typing (dates as dates, '=1+1' stays text, LIST refused), the drive scope and SERVICE_DISABLED errors. Use when reading a specific tab or range of a Sheet, writing query results or a forecast into a Sheet, or appending rows to one. (The separate gsheets community extension is a different product with its own functions.)
Other plugins' skills for the same job