duckdb-gdrive
Google Drive in SQL: files, Sheets, and Drive's own metadata for DuckDB
Google Drive in SQL. Query the Parquet drops, CSV exports and Sheets your
team keeps in Drive directly from DuckDB, and write results back where people
already look. There's no download step and no copy to keep in sync.
SELECT * FROM 'gdrive://Finance/2026/actuals.parquet'; -- files
SELECT * FROM read_csv('https://docs.google.com/spreadsheets/d/1x2y3z/edit'); -- a Sheet, by its address
SELECT name, modified_by, web_url FROM read_gdrive_files('gdrive://Finance/**'); -- Drive's metadata
COPY results TO 'gdrive://Finance/forecast.parquet' (FORMAT parquet); -- and back
COPY results TO 'gdrive://Finance/sales' (FORMAT sheet_range, RANGE 'Forecast!A1'); -- or into a Sheet's tab
| read | write |
|---|
| Files in My Drive and Shared Drives | read_parquet, read_csv, read_json, glob, ATTACH, DuckLake: anything on a gdrive:// path or a Drive address | COPY … TO 'gdrive://…', streamed |
| Sheets and Docs | the same readers: exported as CSV / text; read_sheet_range for any tab or A1 range, typed | COPY … (FORMAT sheet_range, RANGE 'Tab!A1'), in place -- or into a new Sheet it creates |
| Drive's metadata | read_gdrive_files, search_gdrive, gdrive_versions, gdrive_changes, gdrive_permissions, gdrive_drives | — |
One install, one secret -- CREATE SECRET (TYPE gdrive); reuses your gcloud
login. Built for DuckDB v2.0.1 and v1.5.6, by
DataZoo, and the sibling of
duckdb-sharepoint for
Microsoft 365.
🤖 Built for AI pair-programming. The repository ships a
Claude Code plugin: four skills that teach Claude
Code this extension's SQL API, from CREATE SECRET to change feeds and
sharing audits. Install with /plugin marketplace add DataZooDE/duckdb-gdrive
→ /plugin install duckdb-gdrive@duckdb-gdrive.
Contents
Quick start
If you already use gcloud, the login is the whole setup -- ask for the Drive
scope, which gcloud's default does not include:
gcloud auth application-default login \
--scopes=openid,https://www.googleapis.com/auth/drive
INSTALL gdrive FROM community;
LOAD gdrive;
CREATE SECRET (TYPE gdrive);
-- A Parquet file in My Drive
SELECT count(*) FROM 'gdrive://Finance/2026/actuals.parquet';
-- Or paste an address straight from the browser: a file, or a Sheet
SELECT * FROM read_csv('https://drive.google.com/file/d/1a2b3c4d5e/view?usp=sharing');
-- What is in a folder, with who changed it last
SELECT name, size, modified, modified_by FROM read_gdrive_files('gdrive://Finance/2026');
For a server, CI job or anything unattended, name a service-account key
instead -- and bind the secret to a Shared Drive (SELECT name, id FROM gdrive_drives() lists them):
CREATE SECRET gdrive (
TYPE gdrive,
PROVIDER service_account,
KEY_FILE '/etc/creds/sa.json',
DRIVE_ID '0ABcDeFgHiJkLmNoPQ',
DRIVE_SCOPE 'https://www.googleapis.com/auth/drive.readonly'
);
Authentication covers every provider.