Skip to content

Google APIs

Google Sheets, Drive, Calendar and YouTube, plus any Google API through Discovery

Connector software
Free and open source
Service credentials
Required
Use with an agent

Install the Orchard skill in your project to help your agent find connectors, configure them, and verify SQL results.

npx skills add Query-farm/vgi-skills --skill orchard

Copy this request into your coding agent to get started.

Use https://query.farm/products/orchard/connectors/google/index.md to help me query Google APIs with DuckDB or Haybarn 2.0.1 and VGI protocol 3.4. Ask only for missing details about the result I need or whether I want local execution, self-hosting or Query Farm hosting. Check the connector's actual hosting availability, credentials and input requirements. Read one format of each needed reference and the exact object declarations before writing SQL. Use a released connector, and distinguish a saved example result from anything you actually execute. If you cannot run the query, tell me what remains to verify.

Find PDF documents in Google Drive

Uses your connected account. Set up the connector and credentials to run it with your data.

SELECT id, name
FROM google.main.google_drive(query := "mimeType='application/pdf'", count := 100)

Quick start

Choose where to run Google APIs, then follow the steps below.

The connector runs alongside DuckDB or Haybarn. No Query Farm account is needed.

1. Install the vgi extension

Run this in your SQL client. On DuckDB, keep FROM query_farm on LOAD in later sessions.

setup.sql
SET allow_extension_repositories = 'allowed';

CREATE EXTENSION REPOSITORY IF NOT EXISTS query_farm
    WITH PREFIX 'https://duckdb-extensions.query.farm';

INSTALL vgi FROM query_farm;
LOAD vgi FROM query_farm;

2. Attach the connector

Attach with uvx

Needs uv. uvx builds the worker from its release tag on first attach and reuses the cached environment after that.

ATTACH 'google' AS google (
  TYPE vgi,
  LOCATION 'uvx --from git+https://github.com/Query-farm/[email protected] vgi-google-worker'
);

3. Add service credentials

After attaching, create the secret for the service you want to query in the same SQL session. Replace the placeholders with your service settings.

google_service_account credentials

Google service-account credential (default auth for google_sheet / google_drive / google_calendar / google_call): the JSON key in key_json, optional subject for domain-wide delegation, optional scopes (space/comma list).

Get these credentials →
secret.sql
CREATE SECRET google_service_account (
    TYPE google_service_account,
    key_json '<GOOGLE_SERVICE_ACCOUNT_KEY_JSON>',  -- secret
    subject  '<subject>',
    scopes   '<scopes>'
);
google_api_key credentials

Google API key for public-data APIs (google_youtube, public Sheets, google_call on keyed public APIs).

Get these credentials →
secret.sql
CREATE SECRET google_api_key (
    TYPE google_api_key,
    api_key '<GOOGLE_API_KEY_API_KEY>'  -- secret
);
Credential fields and requirements →

4. Run a query

query.sql
SELECT id, name
FROM google.main.google_drive(query := "mimeType='application/pdf'", count := 100)
More example queries →
Technical details
Verified connector release
v0.5.0
Engine
2.0.1
VGI protocol
3.4.0
Verified on
December 1, 2026
Release notes on GitHub
Pin a version for production

When running the connector yourself, keep a specific release until you’re ready to upgrade. Replace the ATTACH statement above with this one and follow the same extension and credential setup.

Attach with uvx

Needs uv. uvx builds the worker from its release tag on first attach and reuses the cached environment after that.

ATTACH 'google' AS google (
  TYPE vgi,
  LOCATION 'uvx --from git+https://github.com/Query-farm/[email protected] vgi-google-worker'
);

Overview

Query Google APIs from SQL: Sheets / Drive / Calendar / YouTube + a generic hatch.

Catalog

Everything google exposes once attached — read straight from the worker's released build.

google 2 schemas
main 1 view · 7 functions

Query Google APIs from SQL: Sheets / Drive / Calendar / YouTube + a generic hatch

Schema examples (8)
Examples (8)

Discover the Sheets API's reachable versions via the Discovery Service.

SELECT name, version, title
FROM google.main.google_apis()
WHERE name LIKE '%sheets%'
ORDER BY name
LIMIT 5;

Browse the Drive v3 methods you can invoke through google_call.

SELECT method, http_method
FROM google.main.google_methods('drive', 'v3')
ORDER BY method
LIMIT 5;

Read a header sheet range, projecting a named column from each row.

SELECT row_number, record ->> '$.name' AS name
FROM google.main.google_sheet('1AbC...', 'Sheet1!A1:Z', header := true)
WHERE row_number <= 100
ORDER BY row_number;

List up to 100 PDF files in Google Drive by MIME type.

SELECT id, name
FROM google.main.google_drive(query := "mimeType='application/pdf'", count := 100);
4 more examples

Search YouTube for 'duckdb' videos and project their view counts.

SELECT video_id, title, view_count
FROM google.main.google_youtube('duckdb', count := 25);

Find Drive PDFs not yet recorded in a tracking sheet: anti-join google_drive against a google_sheet log tab whose file_id column holds the IDs already logged, newest first

SELECT f.id, f.name, f.modified_time
FROM google.main.google_drive(query := "mimeType='application/pdf' and trashed=false", count := 500) AS f ANTI
JOIN google.main.google_sheet('1AbC...', 'Log!A1:B', header := true) AS l ON l.record ->> '$.file_id' = f.id
ORDER BY f.modified_time DESC, f.id;

Meeting load per team for April 2026: join timed primary-calendar events to a roster sheet (email, team) on the organizer e-mail, case-insensitively; organizers missing from the roster are grouped as '(not on roster)'

SELECT coalesce(r.record ->> '$.team', '(not on roster)') AS team,
  count(*) AS events,
  sum(date_diff('minute', e.start_time, e.end_time)) AS meeting_minutes
FROM google.main.google_calendar(calendar_id := 'primary', time_min := '2026-04-01', time_max := '2026-05-01') AS e
LEFT JOIN google.main.google_sheet('1AbC...', 'Roster!A1:B', header := true) AS r ON lower(r.record ->> '$.email') = lower(e.organizer)
WHERE NOT e.all_day
GROUP BY ALL
ORDER BY meeting_minutes DESC, team;

Drive v2 methods with no same-named method in v3 (the legacy calls to remap before migrating, e.g. files.insert became files.create): anti-join the two versions' google_methods listings

SELECT v2.method, v2.http_method
FROM google.main.google_methods('drive', 'v2') AS v2 ANTI
JOIN google.main.google_methods('drive', 'v3') AS v3 ON v3.method = v2.method
ORDER BY v2.method;
Views
google_api_directory 2 examples5 cols

Browsable directory of the Google APIs reachable through the public Discovery Service.

Columns
name VARCHAR
Google API name to pass as the first argument to google_call / google_methods.
version VARCHAR
API version to pass alongside the name (e.g. 'v3').
title VARCHAR
Human-readable API title.
preferred BOOLEAN
TRUE when this is Google's preferred version of the API.
discovery_url VARCHAR
URL of the API's discovery document.
Examples (2)

Find the Sheets APIs in the directory and their versions.

SELECT name, version, title
FROM google.main.google_api_directory
WHERE name LIKE '%sheets%'
ORDER BY name, version;

List the preferred version of every reachable Google API.

SELECT name, version
FROM google.main.google_api_directory
WHERE preferred
ORDER BY name;
Link
Table functions
google_apis (name := VARCHAR) 3 examples

List Google APIs reachable via the Discovery Service

Named arguments
name := VARCHAR
Optional substring filter on API name. · default ""
Returns columns
name VARCHAR
API name to pass as the first google_call argument.
version VARCHAR
API version.
title VARCHAR
Human-readable API title.
preferred BOOLEAN
Whether this is the preferred version of the API.
discovery_url VARCHAR
URL of the API's discovery document.
Examples (3)

Find the Sheets API and its versions

SELECT name, version, title
FROM google.main.google_apis()
WHERE name LIKE '%sheets%';
SELECT name, version, title
FROM google.main.google_apis()
WHERE name LIKE '%sheets%'
ORDER BY name, version
LIMIT 5;
SELECT method, http_method
FROM google.main.google_methods('drive', 'v3')
ORDER BY method
LIMIT 5;
Link
google_calendar (calendar_id := VARCHAR, count := BIGINT, page_size := BIGINT, query := VARCHAR, single_events := BOOLEAN, time_max := VARCHAR, time_min := VARCHAR) 2 examples

List Google Calendar events as rows

Named arguments
calendar_id := VARCHAR
Calendar ID ('primary' or an address). · default "primary"
count := BIGINT
Maximum events to return. · default 250
page_size := BIGINT
Events per request (0 = automatic). · default 0
query := VARCHAR
Free-text event search. · default ""
single_events := BOOLEAN
Expand recurring events into instances. · default true
time_max := VARCHAR
Upper time bound (date or RFC-3339). · default ""
time_min := VARCHAR
Lower time bound (date or RFC-3339). · default ""
Returns columns
id VARCHAR
Event ID.
summary VARCHAR
Event title/summary.
description VARCHAR
Event description / notes.
location VARCHAR
Free-text event location.
status VARCHAR
Event status (confirmed, tentative, or cancelled).
start_time TIMESTAMPTZ
Start as a UTC timestamp; NULL for all-day events.
end_time TIMESTAMPTZ
End as a UTC timestamp; NULL for all-day events.
all_day BOOLEAN
True when the event is an all-day (date-only) event.
organizer VARCHAR
Organizer e-mail, when present.
creator VARCHAR
Creator e-mail, when present.
html_link VARCHAR
A link to the event in the Calendar UI.
extra VARCHAR
JSON-encoded object of any additional event fields returned by the Calendar API beyond the typed columns (read with the json extension's ->> operator).
Examples (2)

List up to 50 events on the primary calendar

SELECT id, summary, start_time
FROM google.main.google_calendar(calendar_id := 'primary', count := 50);

Meeting load per team for April 2026: join timed primary-calendar events to a roster sheet (email, team) on the organizer e-mail, case-insensitively; organizers missing from the roster are grouped as '(not on roster)'

SELECT coalesce(r.record ->> '$.team', '(not on roster)') AS team,
  count(*) AS events,
  sum(date_diff('minute', e.start_time, e.end_time)) AS meeting_minutes
FROM google.main.google_calendar(calendar_id := 'primary', time_min := '2026-04-01', time_max := '2026-05-01') AS e
LEFT JOIN google.main.google_sheet('1AbC...', 'Roster!A1:B', header := true) AS r ON lower(r.record ->> '$.email') = lower(e.organizer)
WHERE NOT e.all_day
GROUP BY ALL
ORDER BY meeting_minutes DESC, team;
Link
google_call (api VARCHAR, version VARCHAR, method VARCHAR, params_json VARCHAR, count := BIGINT) 1 example

Call any Google API method; returns JSON rows (generic escape hatch)

Positional arguments
api VARCHAR
Discovery API name, e.g. 'gmail'.
version VARCHAR
API version, e.g. 'v1'.
method VARCHAR
Dotted method path, e.g. 'users.messages.list'.
params_json VARCHAR
JSON object of method parameters, e.g. '{"userId":"me"}'.
Named arguments
count := BIGINT
Maximum rows to return. · default 1000
Returns columns
result VARCHAR
One result object as a JSON-encoded string (read with the json extension's ->> operator). If the response has a single list field (e.g. files, items, messages), each element is a row; otherwise the whole response is one row.
Example

List the user-created Gmail label names via the generic hatch

SELECT result ->> '$.name' AS label
FROM google.main.google_call('gmail', 'v1', 'users.labels.list', '{"userId":"me"}')
WHERE result ->> '$.type' = 'user'
ORDER BY label;
Link
google_drive (count := BIGINT, drive_id := VARCHAR, order_by := VARCHAR, page_size := BIGINT, query := VARCHAR) 2 examples

List/search Google Drive files as rows

Named arguments
count := BIGINT
Maximum files to return. · default 100
drive_id := VARCHAR
Shared Drive ID to search within. · default ""
order_by := VARCHAR
Sort key, e.g. 'modifiedTime desc'. · default ""
page_size := BIGINT
Files per request (0 = automatic). · default 0
query := VARCHAR
Drive 'q' search query (Drive query syntax). · default ""
Returns columns
id VARCHAR
Drive file ID.
name VARCHAR
File name.
mime_type VARCHAR
MIME type (e.g. application/pdf).
modified_time TIMESTAMPTZ
Last modification time.
created_time TIMESTAMPTZ
Creation time.
size BIGINT
Size in bytes, when the file has a binary content size.
web_view_link VARCHAR
A link to open the file in a browser.
icon_link VARCHAR
A link to the file's icon.
parents VARCHAR[]
Parent folder IDs.
owner VARCHAR
Primary owner display name, when available.
trashed BOOLEAN
Whether the file is in the trash.
starred BOOLEAN
Whether the file is starred.
extra VARCHAR
JSON-encoded object of any additional file fields returned by the Drive API beyond the typed columns (read with the json extension's ->> operator).
Examples (2)

List up to 100 PDFs

SELECT id, name
FROM google.main.google_drive(query := "mimeType='application/pdf'", count := 100);

Find Drive PDFs not yet recorded in a tracking sheet: anti-join google_drive against a google_sheet log tab whose file_id column holds the IDs already logged, newest first

SELECT f.id, f.name, f.modified_time
FROM google.main.google_drive(query := "mimeType='application/pdf' and trashed=false", count := 500) AS f ANTI
JOIN google.main.google_sheet('1AbC...', 'Log!A1:B', header := true) AS l ON l.record ->> '$.file_id' = f.id
ORDER BY f.modified_time DESC, f.id;
Link
google_methods (api VARCHAR, version VARCHAR) 2 examples

List the callable methods of a Google API (for google_call)

Arguments
api VARCHAR
Discovery API name, e.g. 'drive'.
version VARCHAR
API version, e.g. 'v3'.
Returns columns
method VARCHAR
Dotted method path to pass to google_call.
http_method VARCHAR
HTTP verb (GET/POST/...).
path VARCHAR
URL path template.
description VARCHAR
Method description.
parameters VARCHAR[]
Parameter names.
required_parameters VARCHAR[]
Required parameter names.
Examples (2)

List Drive v3 methods reachable via google_call

SELECT method, http_method FROM google.main.google_methods('drive', 'v3');

Drive v2 methods with no same-named method in v3 (the legacy calls to remap before migrating, e.g. files.insert became files.create): anti-join the two versions' google_methods listings

SELECT v2.method, v2.http_method
FROM google.main.google_methods('drive', 'v2') AS v2 ANTI
JOIN google.main.google_methods('drive', 'v3') AS v3 ON v3.method = v2.method
ORDER BY v2.method;
Link
google_sheet (spreadsheet_id VARCHAR, range VARCHAR, count := BIGINT, header := BOOLEAN) 1 example

Read a Google Sheets range as rows (values, optional header)

Positional arguments
spreadsheet_id VARCHAR
Spreadsheet ID (from the sheet URL).
range VARCHAR
A1 range, e.g. 'Sheet1!A1:Z'.
Named arguments
count := BIGINT
Maximum rows to return. · default 10000
header := BOOLEAN
Treat the first row as column headers. · default false
Returns columns
row_number BIGINT
1-based row index within the range (after any header row).
values VARCHAR[]
The row's cells as text.
record VARCHAR
With the header argument true, a JSON-encoded object of header to cell for this row (read with the json extension's ->> operator); else NULL.
Example

Read the first 100 data rows of a header sheet, projecting the 'name' column

SELECT row_number, record ->> '$.name' AS name
FROM google.main.google_sheet('1AbC...', 'Sheet1!A1:Z', header := true)
WHERE row_number <= 100
ORDER BY row_number;
Link
google_youtube (query VARCHAR, count := BIGINT, order_by := VARCHAR, page_size := BIGINT) 1 example

Search YouTube videos as rows (with view/like/comment counts)

Positional arguments
query VARCHAR
Search query.
Named arguments
count := BIGINT
Maximum videos to return. · default 25
order_by := VARCHAR
Result order: relevance/date/viewCount/rating. · default ""
page_size := BIGINT
Videos per request (0 = automatic). · default 0
Returns columns
video_id VARCHAR
YouTube video ID.
title VARCHAR
Video title.
description VARCHAR
Video description snippet.
channel_title VARCHAR
Channel display name.
channel_id VARCHAR
Channel ID.
published_at TIMESTAMPTZ
Publication time.
view_count BIGINT
View count, when statistics are available.
like_count BIGINT
Like count, when statistics are available.
comment_count BIGINT
Comment count, when statistics are available.
duration VARCHAR
ISO-8601 duration (e.g. PT4M13S), when available.
url VARCHAR
Canonical watch URL.
extra VARCHAR
JSON-encoded object of any additional video fields returned by the YouTube API beyond the typed columns (read with the json extension's ->> operator).
Example

Search YouTube for 'duckdb'

SELECT video_id, title, view_count
FROM google.main.google_youtube('duckdb', count := 25);
Link
workspace 13 functions

Google Workspace admin data: Directory, Reports audit log and usage, Alert Center, Groups Settings

Schema examples (6)
Examples (6)

Super administrators who are not enrolled in 2-step verification.

SELECT primary_email, last_login_time
FROM google.workspace.users()
WHERE is_admin AND NOT is_enrolled_in_2sv
ORDER BY primary_email;

Failed sign-ins during the first week of November 2026.

SELECT time, actor_email, ip_address
FROM google.workspace.activities('login')
WHERE event_name = 'login_failure' AND time >= TIMESTAMPTZ '2026-11-01 00:00:00+00' AND time < TIMESTAMPTZ '2026-11-08 00:00:00+00'
ORDER BY time;

Tenant user count on one day from the usage reports.

SELECT int_value AS users
FROM google.workspace.usage_reports()
WHERE date = DATE '2026-11-10' AND parameter = 'accounts:num_users';

High-severity Alert Center alerts created since November 2026.

SELECT create_time, type, status
FROM google.workspace.alerts()
WHERE create_time >= TIMESTAMPTZ '2026-11-01 00:00:00+00' AND severity = 'HIGH'
ORDER BY create_time DESC;
2 more examples

Who holds which admin role: join role assignments to role names and to the assignee's user record (users are matched on their immutable ID)

SELECT r.role_name, u.primary_email, a.scope_type
FROM google.workspace.role_assignments() AS a
JOIN google.workspace.roles() AS r USING (role_id)
LEFT JOIN google.workspace.users() AS u ON u.id = a.assigned_to
ORDER BY r.role_name, u.primary_email;

Failed sign-ins in November 2026 per organizational unit: login_failure events (time and event name pushed to the Reports API) joined to the actor's user record

SELECT u.org_unit_path, count(*) AS failures
FROM google.workspace.activities('login') AS e
JOIN google.workspace.users() AS u ON u.primary_email = e.actor_email
WHERE e.event_name = 'login_failure' AND e.time >= TIMESTAMPTZ '2026-11-01 00:00:00+00' AND e.time < TIMESTAMPTZ '2026-12-01 00:00:00+00'
GROUP BY ALL
ORDER BY failures DESC;
Table functions
activities (application VARCHAR, actor_ip_address := VARCHAR, count := BIGINT, end_time := VARCHAR, event_name := VARCHAR, filters := VARCHAR, group_id_filter := VARCHAR, org_unit_id := VARCHAR, page_size := BIGINT, start_time := VARCHAR, user_key := VARCHAR) 4 examples

Google Workspace audit-log events from the Admin SDK Reports API

Positional arguments
application VARCHAR
Audit application, e.g. 'login', 'admin', 'drive', 'token', 'saml', 'groups'.
Named arguments
actor_ip_address := VARCHAR
Only events from this IP address. · default ""
count := BIGINT
Maximum rows to return. · default 100000
end_time := VARCHAR
Latest event time (date or RFC-3339). · default ""
event_name := VARCHAR
Only this event name, e.g. 'login_failure'. · default ""
filters := VARCHAR
Reports parameter filters, e.g. 'doc_type==document'. · default ""
group_id_filter := VARCHAR
Only actors in these groups ('id:...,id:...'). · default ""
org_unit_id := VARCHAR
Only actors in this org unit ('id:...'). · default ""
page_size := BIGINT
Rows per API request (0 = the API maximum). · default 0
start_time := VARCHAR
Earliest event time (date or RFC-3339). · default ""
user_key := VARCHAR
'all' or one user's e-mail / profile ID. · default "all"
Returns columns
time TIMESTAMPTZ
When the activity occurred.
application_name VARCHAR
Audit application, e.g. 'login', 'admin', 'drive'.
unique_qualifier VARCHAR
Disambiguates activities with the same time.
customer_id VARCHAR
Workspace customer ID.
actor_email VARCHAR
Primary e-mail of the actor, when there is one.
actor_profile_id VARCHAR
Workspace profile ID of the actor.
actor_caller_type VARCHAR
Actor type, e.g. USER or KEY.
actor_key VARCHAR
OAuth consumer key / robot ID when caller type is KEY.
ip_address VARCHAR
IP address the action was performed from.
owner_domain VARCHAR
Domain affected by the event.
event_index INTEGER
Position of this event within the activity record (0-based).
event_type VARCHAR
Event type, e.g. 'login' or 'USER_SETTINGS'.
event_name VARCHAR
Event name, e.g. 'login_failure' or 'CHANGE_PASSWORD'.
parameters VARCHAR
Event parameters as a JSON object keyed by parameter name.
network_info VARCHAR
Network details (IP ASNs, region), JSON.
resource_details VARCHAR
Resources the activity acted on, JSON.
etag VARCHAR
ETag of the activity record.
Examples (4)

Failed sign-ins in the first week of November 2026 (time range and event name pushed down)

SELECT time, actor_email, ip_address,
  parameters ->> '$.login_failure_type' AS failure_type
FROM google.workspace.activities('login')
WHERE event_name = 'login_failure' AND time >= TIMESTAMPTZ '2026-11-01 00:00:00+00' AND time < TIMESTAMPTZ '2026-11-08 00:00:00+00'
ORDER BY time;

Admin console changes made by one administrator, by event name

SELECT event_name, count(*) AS n
FROM google.workspace.activities('admin')
WHERE actor_email = '[email protected]'
GROUP BY event_name
ORDER BY n DESC, event_name;

Third-party OAuth grants (token audit), newest first

SELECT time, actor_email, parameters ->> '$.app_name' AS app
FROM google.workspace.activities('token')
WHERE event_name = 'authorize'
ORDER BY time DESC
LIMIT 100;
1 more example

Failed sign-ins in November 2026 per organizational unit: login_failure events (time and event name pushed to the Reports API) joined to the actor's user record

SELECT u.org_unit_path, count(*) AS failures
FROM google.workspace.activities('login') AS e
JOIN google.workspace.users() AS u ON u.primary_email = e.actor_email
WHERE e.event_name = 'login_failure' AND e.time >= TIMESTAMPTZ '2026-11-01 00:00:00+00' AND e.time < TIMESTAMPTZ '2026-12-01 00:00:00+00'
GROUP BY ALL
ORDER BY failures DESC;
Link
alerts (count := BIGINT, customer_id := VARCHAR, filter := VARCHAR, order_by := VARCHAR, page_size := BIGINT) 2 examples

Google Workspace security and system alerts from the Alert Center API

Named arguments
count := BIGINT
Maximum rows to return. · default 100000
customer_id := VARCHAR
Customer ID (default: the admin's tenant). · default ""
filter := VARCHAR
Alert Center filter, e.g. 'severity="HIGH"' (AND-ed with pushdown). · default ""
order_by := VARCHAR
Sort order, e.g. 'create_time desc'. · default ""
page_size := BIGINT
Rows per API request (0 = the API maximum). · default 0
Returns columns
alert_id VARCHAR
Alert ID.
customer_id VARCHAR
Workspace customer ID.
type VARCHAR
Alert type, e.g. 'Suspicious login'.
source VARCHAR
Alert source, e.g. 'Google identity'.
create_time TIMESTAMPTZ
When the alert was created.
start_time TIMESTAMPTZ
When the first event behind the alert happened.
end_time TIMESTAMPTZ
When the last event behind the alert happened.
update_time TIMESTAMPTZ
When the alert was last updated.
deleted BOOLEAN
Whether the alert is marked deleted.
status VARCHAR
Triage status from alert metadata, e.g. NOT_STARTED.
severity VARCHAR
Severity from alert metadata: HIGH, MEDIUM or LOW.
assignee VARCHAR
E-mail of the assigned administrator.
security_investigation_tool_link VARCHAR
Link to the security investigation tool.
data VARCHAR
Type-specific alert payload, JSON.
Examples (2)

High-severity alerts created since 2026-11-01 (the time bound is pushed into the filter)

SELECT create_time, type, source, status
FROM google.workspace.alerts()
WHERE create_time >= TIMESTAMPTZ '2026-11-01 00:00:00+00' AND severity = 'HIGH'
ORDER BY create_time DESC;

Open alert counts by type

SELECT type, count(*) AS open_alerts
FROM google.workspace.alerts()
WHERE status <> 'CLOSED' AND NOT deleted
GROUP BY type
ORDER BY open_alerts DESC, type;
Link
chromeos_devices (count := BIGINT, customer := VARCHAR, org_unit_path := VARCHAR, page_size := BIGINT, query := VARCHAR) 2 examples

Managed ChromeOS devices from the Admin SDK Directory API

Named arguments
count := BIGINT
Maximum rows to return. · default 1000000
customer := VARCHAR
Customer ID, or 'my_customer' for the admin's own tenant. · default "my_customer"
org_unit_path := VARCHAR
Only devices in this org unit. · default ""
page_size := BIGINT
Rows per API request (0 = the API maximum). · default 0
query := VARCHAR
ChromeOS device search, e.g. "status:provisioned". · default ""
Returns columns
device_id VARCHAR
Unique device ID.
serial_number VARCHAR
Hardware serial number.
status VARCHAR
Device status, e.g. ACTIVE, DISABLED, DEPROVISIONED.
model VARCHAR
Device model.
os_version VARCHAR
ChromeOS version.
platform_version VARCHAR
ChromeOS platform version.
firmware_version VARCHAR
Firmware version.
org_unit_path VARCHAR
Organizational unit the device is in.
annotated_user VARCHAR
Admin-annotated user.
annotated_location VARCHAR
Admin-annotated location.
annotated_asset_id VARCHAR
Admin-annotated asset ID.
notes VARCHAR
Admin notes.
mac_address VARCHAR
Wireless MAC address.
last_sync TIMESTAMPTZ
Last policy sync with the management server.
last_enrollment_time TIMESTAMPTZ
Most recent enrollment time.
support_end_date TIMESTAMPTZ
Final date the device model is supported.
auto_update_through TIMESTAMPTZ
Time after which the device stops receiving updates.
boot_mode VARCHAR
Boot mode: Verified or Dev.
recent_users VARCHAR[]
E-mails of recent users, most recent first.
extra VARCHAR
Remaining device fields (CPU/disk/RAM reports, active time ranges, network), JSON.
Examples (2)

Devices past their auto-update expiration

SELECT serial_number, model, auto_update_through
FROM google.workspace.chromeos_devices()
WHERE auto_update_through < TIMESTAMPTZ '2026-11-15 00:00:00+00'
ORDER BY auto_update_through;

Device count per model in one org unit (org_unit_path is pushed down)

SELECT model, count(*) AS devices
FROM google.workspace.chromeos_devices()
WHERE org_unit_path = '/Classrooms'
GROUP BY model
ORDER BY devices DESC, model;
Link
domains (count := BIGINT, customer := VARCHAR) 2 examples

Google Workspace domains from the Admin SDK Directory API

Named arguments
count := BIGINT
Maximum rows to return. · default 10000
customer := VARCHAR
Customer ID, or 'my_customer' for the admin's own tenant. · default "my_customer"
Returns columns
domain_name VARCHAR
Domain name.
is_primary BOOLEAN
Whether this is the primary domain.
verified BOOLEAN
Whether ownership of the domain is verified.
creation_time TIMESTAMPTZ
When the domain was added.
domain_aliases VARCHAR[]
Alias domain names of this domain.
Examples (2)

Unverified domains in the tenant

SELECT domain_name, creation_time
FROM google.workspace.domains()
WHERE NOT verified
ORDER BY domain_name;

Every domain with its alias domains

SELECT domain_name, is_primary, domain_aliases
FROM google.workspace.domains()
ORDER BY domain_name;
Link
group_members (group_key VARCHAR, count := BIGINT, include_derived_membership := BOOLEAN, page_size := BIGINT, roles := VARCHAR) 2 examples

Members of a Google Workspace group from the Admin SDK Directory API

Positional arguments
group_key VARCHAR
The group's e-mail address; an alias or the unique group ID also works.
Named arguments
count := BIGINT
Maximum rows to return. · default 100000
include_derived_membership := BOOLEAN
Also list members of nested groups. · default false
page_size := BIGINT
Rows per API request (0 = the API maximum). · default 0
roles := VARCHAR
Comma list of OWNER, MANAGER, MEMBER to restrict to. · default ""
Returns columns
group_key VARCHAR
The group that was listed (as passed in).
id VARCHAR
Member's immutable ID (user or group).
email VARCHAR
Member's e-mail address.
role VARCHAR
OWNER, MANAGER or MEMBER.
type VARCHAR
USER, GROUP, CUSTOMER or EXTERNAL.
status VARCHAR
Membership status, e.g. ACTIVE or SUSPENDED.
delivery_settings VARCHAR
Mail delivery preference, e.g. ALL_MAIL or DIGEST.
Examples (2)

Owners and managers of a group (the role filter is pushed into the roles parameter)

SELECT email, role
FROM google.workspace.group_members('[email protected]')
WHERE role IN ('OWNER', 'MANAGER')
ORDER BY role, email;

External or customer-wide members of a group

SELECT email, type
FROM google.workspace.group_members('[email protected]')
WHERE type IN ('EXTERNAL', 'CUSTOMER')
ORDER BY email;
Link
group_settings (group_email VARCHAR, count := BIGINT) 2 examples

Access and moderation settings of a Google group from the Groups Settings API

Positional arguments
group_email VARCHAR
The group's e-mail address.
Named arguments
count := BIGINT
Maximum rows to return. · default 1
Returns columns
email VARCHAR
Group e-mail address.
name VARCHAR
Groups Settings 'name'.
who_can_join VARCHAR
Groups Settings 'whoCanJoin'.
who_can_view_membership VARCHAR
Groups Settings 'whoCanViewMembership'.
who_can_view_group VARCHAR
Groups Settings 'whoCanViewGroup'.
who_can_post_message VARCHAR
Groups Settings 'whoCanPostMessage'.
who_can_contact_owner VARCHAR
Groups Settings 'whoCanContactOwner'.
who_can_discover_group VARCHAR
Groups Settings 'whoCanDiscoverGroup'.
who_can_moderate_members VARCHAR
Groups Settings 'whoCanModerateMembers'.
who_can_moderate_content VARCHAR
Groups Settings 'whoCanModerateContent'.
who_can_leave_group VARCHAR
Groups Settings 'whoCanLeaveGroup'.
message_moderation_level VARCHAR
Groups Settings 'messageModerationLevel'.
spam_moderation_level VARCHAR
Groups Settings 'spamModerationLevel'.
allow_external_members BOOLEAN
Groups Settings 'allowExternalMembers' (true/false).
allow_web_posting BOOLEAN
Groups Settings 'allowWebPosting' (true/false).
members_can_post_as_the_group BOOLEAN
Groups Settings 'membersCanPostAsTheGroup' (true/false).
include_in_global_address_list BOOLEAN
Groups Settings 'includeInGlobalAddressList' (true/false).
enable_collaborative_inbox BOOLEAN
Groups Settings 'enableCollaborativeInbox' (true/false).
is_archived BOOLEAN
Groups Settings 'isArchived' (true/false).
archive_only BOOLEAN
Groups Settings 'archiveOnly' (true/false).
settings VARCHAR
The full Groups Settings resource, JSON.
Examples (2)

Who can join, view membership and post to one group, and whether outsiders are allowed

SELECT who_can_join, who_can_view_membership, who_can_post_message,
  allow_external_members
FROM google.workspace.group_settings('[email protected]');

Read a setting that has no typed column from the full settings JSON

SELECT settings ->> '$.whoCanAddReferences' AS who_can_add_references
FROM google.workspace.group_settings('[email protected]');
Link
groups (count := BIGINT, customer := VARCHAR, domain := VARCHAR, page_size := BIGINT, query := VARCHAR, user_key := VARCHAR) 2 examples

Google Workspace groups from the Admin SDK Directory API

Named arguments
count := BIGINT
Maximum rows to return. · default 100000
customer := VARCHAR
Customer ID, or 'my_customer' for the admin's own tenant. · default "my_customer"
domain := VARCHAR
Restrict to one domain (instead of the whole customer). · default ""
page_size := BIGINT
Rows per API request (0 = the API maximum). · default 0
query := VARCHAR
Directory group-search clauses, e.g. "name:eng*". · default ""
user_key := VARCHAR
List only the groups this user or group belongs to. · default ""
Returns columns
id VARCHAR
Immutable group ID.
email VARCHAR
Group e-mail address.
name VARCHAR
Group display name.
description VARCHAR
Group description.
direct_members_count BIGINT
Number of direct members (users and groups).
admin_created BOOLEAN
Whether an administrator (not a user) created the group.
aliases VARCHAR[]
E-mail aliases of the group.
non_editable_aliases VARCHAR[]
Read-only aliases of the group.
Examples (2)

The largest groups by direct member count

SELECT email, name, direct_members_count
FROM google.workspace.groups()
ORDER BY direct_members_count DESC, email
LIMIT 20;

Groups a given user belongs to

SELECT email, name
FROM google.workspace.groups(user_key := '[email protected]')
ORDER BY email;
Link
mobile_devices (count := BIGINT, customer := VARCHAR, page_size := BIGINT, query := VARCHAR) 2 examples

Managed mobile devices from the Admin SDK Directory API

Named arguments
count := BIGINT
Maximum rows to return. · default 1000000
customer := VARCHAR
Customer ID, or 'my_customer' for the admin's own tenant. · default "my_customer"
page_size := BIGINT
Rows per API request (0 = the API maximum). · default 0
query := VARCHAR
Mobile device search, e.g. "status:approved". · default ""
Returns columns
resource_id VARCHAR
Unique ID the API uses for the device.
device_id VARCHAR
Device serial-style ID.
email VARCHAR[]
E-mail addresses of the device's owners.
name VARCHAR[]
Owner names.
model VARCHAR
Device model.
os VARCHAR
Operating system and version.
type VARCHAR
Device type, e.g. ANDROID, IOS_SYNC.
status VARCHAR
Status, e.g. APPROVED, BLOCKED, PENDING.
first_sync TIMESTAMPTZ
First sync with the management server.
last_sync TIMESTAMPTZ
Most recent sync.
device_compromised_status VARCHAR
Compromised status (e.g. rooted/jailbroken).
encryption_status VARCHAR
Device encryption status.
device_password_status VARCHAR
Whether a device password is set.
security_patch_level TIMESTAMPTZ
Android security patch level date.
serial_number VARCHAR
Hardware serial number.
manufacturer VARCHAR
Device manufacturer.
user_agent VARCHAR
User agent of the sync client.
extra VARCHAR
Remaining device fields (applications, other accounts, network), JSON.
Examples (2)

Compromised or unencrypted mobile devices

SELECT email, model, os, device_compromised_status, encryption_status
FROM google.workspace.mobile_devices()
WHERE device_compromised_status = 'Compromised' OR encryption_status = 'Unencrypted'
ORDER BY model;

Mobile devices that have not synced since 2026-10-01

SELECT resource_id, model, last_sync
FROM google.workspace.mobile_devices()
WHERE last_sync < TIMESTAMPTZ '2026-10-01 00:00:00+00'
ORDER BY last_sync;
Link
org_units (count := BIGINT, customer := VARCHAR, org_unit_path := VARCHAR, type := VARCHAR) 2 examples

Google Workspace organizational units from the Admin SDK Directory API

Named arguments
count := BIGINT
Maximum rows to return. · default 100000
customer := VARCHAR
Customer ID, or 'my_customer' for the admin's own tenant. · default "my_customer"
org_unit_path := VARCHAR
Start below this org unit (default: root). · default ""
type := VARCHAR
'all', 'children' or 'allIncludingParent'. · default "all"
Returns columns
org_unit_id VARCHAR
Immutable organizational-unit ID ('id:...').
org_unit_path VARCHAR
Full path, e.g. '/Engineering/Platform'.
name VARCHAR
Organizational-unit name.
description VARCHAR
Description.
parent_org_unit_id VARCHAR
Parent organizational-unit ID.
parent_org_unit_path VARCHAR
Parent organizational-unit path.
block_inheritance BOOLEAN
Deprecated inheritance-blocking flag.
Examples (2)

The organizational-unit tree, ordered by path

SELECT org_unit_path, name, parent_org_unit_path
FROM google.workspace.org_units()
ORDER BY org_unit_path;

Direct child units of /Engineering

SELECT org_unit_path
FROM google.workspace.org_units(org_unit_path := '/Engineering', type := 'children')
ORDER BY org_unit_path;
Link
role_assignments (count := BIGINT, customer := VARCHAR, page_size := BIGINT, role_id := VARCHAR, user_key := VARCHAR) 2 examples

Google Workspace admin role assignments from the Admin SDK Directory API

Named arguments
count := BIGINT
Maximum rows to return. · default 100000
customer := VARCHAR
Customer ID, or 'my_customer' for the admin's own tenant. · default "my_customer"
page_size := BIGINT
Rows per API request (0 = the API maximum). · default 0
role_id := VARCHAR
Only assignments of this role ID. · default ""
user_key := VARCHAR
Only assignments held by this user (e-mail or ID). · default ""
Returns columns
role_assignment_id VARCHAR
Role-assignment ID.
role_id VARCHAR
Assigned role ID (join to roles.role_id).
assigned_to VARCHAR
Unique ID of the assignee (user, group or service account).
assignee_type VARCHAR
USER or GROUP.
scope_type VARCHAR
CUSTOMER (tenant-wide) or ORG_UNIT.
org_unit_id VARCHAR
Organizational unit the assignment is scoped to (ORG_UNIT scope).
condition VARCHAR
Optional assignment condition expression.
expire_time TIMESTAMPTZ
When a time-limited assignment expires.
Examples (2)

Assignments of one role (role_id is pushed into the roleId parameter)

SELECT assigned_to, assignee_type, scope_type
FROM google.workspace.role_assignments()
WHERE role_id = '9170516996784129'
ORDER BY assigned_to;

Who holds which admin role: join role assignments to role names and to the assignee's user record (users are matched on their immutable ID)

SELECT r.role_name, u.primary_email, a.scope_type
FROM google.workspace.role_assignments() AS a
JOIN google.workspace.roles() AS r USING (role_id)
LEFT JOIN google.workspace.users() AS u ON u.id = a.assigned_to
ORDER BY r.role_name, u.primary_email;
Link
roles (count := BIGINT, customer := VARCHAR, page_size := BIGINT) 2 examples

Google Workspace admin roles and privileges from the Admin SDK Directory API

Named arguments
count := BIGINT
Maximum rows to return. · default 10000
customer := VARCHAR
Customer ID, or 'my_customer' for the admin's own tenant. · default "my_customer"
page_size := BIGINT
Rows per API request (0 = the API maximum). · default 0
Returns columns
role_id VARCHAR
Role ID.
role_name VARCHAR
Role name.
role_description VARCHAR
Role description.
is_system_role BOOLEAN
Whether this is a pre-defined system role.
is_super_admin_role BOOLEAN
Whether this is the super-admin role.
privileges STRUCT(privilege_name VARCHAR, service_id VARCHAR)[]
Granted privileges as LIST<STRUCT(privilege_name, service_id)>.
Examples (2)

Custom (non-system) admin roles and how many privileges each grants

SELECT role_name, len(privileges) AS privilege_count
FROM google.workspace.roles()
WHERE NOT is_system_role
ORDER BY privilege_count DESC, role_name;

Who holds which admin role: join role assignments to role names and to the assignee's user record (users are matched on their immutable ID)

SELECT r.role_name, u.primary_email, a.scope_type
FROM google.workspace.role_assignments() AS a
JOIN google.workspace.roles() AS r USING (role_id)
LEFT JOIN google.workspace.users() AS u ON u.id = a.assigned_to
ORDER BY r.role_name, u.primary_email;
Link
usage_reports (count := BIGINT, customer_id := VARCHAR, date := VARCHAR, filters := VARCHAR, org_unit_id := VARCHAR, page_size := BIGINT, parameters := VARCHAR, report := VARCHAR, user_key := VARCHAR) 2 examples

Google Workspace daily usage metrics from the Admin SDK Reports API

Named arguments
count := BIGINT
Maximum rows to return. · default 1000000
customer_id := VARCHAR
Customer ID (default: the admin's tenant). · default ""
date := VARCHAR
Report day 'YYYY-MM-DD' (or filter on the date column). · default ""
filters := VARCHAR
User report only: metric filters, e.g. 'gmail:num_emails_sent>0'. · default ""
org_unit_id := VARCHAR
User report only: users in this org unit ('id:...'). · default ""
page_size := BIGINT
Rows per API request (0 = the API maximum). · default 0
parameters := VARCHAR
Comma list of metrics, e.g. 'accounts:num_users,gmail:num_emails_sent'. · default ""
report := VARCHAR
'customer' (tenant totals) or 'user' (per user). · default "customer"
user_key := VARCHAR
User report only: 'all' or one user's e-mail. · default "all"
Returns columns
date DATE
Report date (UTC).
entity_type VARCHAR
CUSTOMER or USER.
customer_id VARCHAR
Workspace customer ID.
user_email VARCHAR
User e-mail (user reports).
profile_id VARCHAR
User profile ID (user reports).
parameter VARCHAR
Metric name as app:metric, e.g. 'accounts:num_users'.
int_value BIGINT
Integer metric value.
bool_value BOOLEAN
Boolean metric value.
string_value VARCHAR
String metric value.
datetime_value TIMESTAMPTZ
Timestamp metric value.
msg_value VARCHAR
Structured metric value, JSON.
Examples (2)

Tenant-wide user and storage metrics for one day (date and metric names pushed down)

SELECT parameter, int_value
FROM google.workspace.usage_reports()
WHERE date = DATE '2026-11-10' AND parameter IN ('accounts:num_users', 'accounts:used_quota_in_mb')
ORDER BY parameter;

Daily e-mails sent per user over one week

SELECT date, user_email, int_value AS emails_sent
FROM google.workspace.usage_reports(report := 'user', parameters := 'gmail:num_emails_sent')
WHERE date BETWEEN DATE '2026-11-01' AND DATE '2026-11-07'
ORDER BY date, emails_sent DESC;
Link
users (count := BIGINT, customer := VARCHAR, domain := VARCHAR, order_by := VARCHAR, page_size := BIGINT, projection := VARCHAR, query := VARCHAR, show_deleted := BOOLEAN) 3 examples

Google Workspace user accounts from the Admin SDK Directory API

Named arguments
count := BIGINT
Maximum rows to return. · default 100000
customer := VARCHAR
Customer ID, or 'my_customer' for the admin's own tenant. · default "my_customer"
domain := VARCHAR
Restrict to one domain (instead of the whole customer). · default ""
order_by := VARCHAR
Sort key: email, givenName or familyName. · default ""
page_size := BIGINT
Rows per API request (0 = the API maximum). · default 0
projection := VARCHAR
'basic' or 'full' (includes custom schemas). · default "basic"
query := VARCHAR
Directory user-search clauses, e.g. "orgName=Engineering". · default ""
show_deleted := BOOLEAN
List recently deleted users instead. · default false
Returns columns
id VARCHAR
Immutable user ID.
primary_email VARCHAR
Primary e-mail address.
full_name VARCHAR
Full name.
given_name VARCHAR
Given (first) name.
family_name VARCHAR
Family (last) name.
is_admin BOOLEAN
Whether the user is a super administrator.
is_delegated_admin BOOLEAN
Whether the user is a delegated administrator.
suspended BOOLEAN
Whether the account is suspended.
suspension_reason VARCHAR
Why the account was suspended, when suspended.
archived BOOLEAN
Whether the account is archived.
org_unit_path VARCHAR
Organizational unit path, e.g. '/Sales'.
is_enrolled_in_2sv BOOLEAN
Whether the user is enrolled in 2-step verification.
is_enforced_in_2sv BOOLEAN
Whether 2-step verification is enforced for the user.
creation_time TIMESTAMPTZ
When the account was created.
last_login_time TIMESTAMPTZ
Last sign-in time; NULL when the user never signed in.
deletion_time TIMESTAMPTZ
When the account was deleted (show_deleted scans only).
is_mailbox_setup BOOLEAN
Whether the Gmail mailbox has been created.
agreed_to_terms BOOLEAN
Whether the user accepted the Terms of Service.
change_password_at_next_login BOOLEAN
Whether a password change is forced at next sign-in.
include_in_global_address_list BOOLEAN
Whether the user is listed in the global address list.
is_guest_user BOOLEAN
Whether the account is a guest user.
customer_id VARCHAR
Workspace customer ID that owns the account.
aliases VARCHAR[]
E-mail aliases.
non_editable_aliases VARCHAR[]
Read-only aliases (e.g. from secondary domains).
recovery_email VARCHAR
Recovery e-mail address.
thumbnail_photo_url VARCHAR
Profile photo URL.
extra VARCHAR
Remaining user fields (emails, phones, organizations, relations, custom schemas), JSON.
Examples (3)

Super administrators without 2-step verification (both predicates are pushed down)

SELECT primary_email, last_login_time
FROM google.workspace.users()
WHERE is_admin AND NOT is_enrolled_in_2sv
ORDER BY primary_email;

Accounts in the Sales org unit that have not signed in since 2026-08-01

SELECT primary_email, last_login_time
FROM google.workspace.users()
WHERE org_unit_path = '/Sales' AND (last_login_time IS NULL OR last_login_time < TIMESTAMPTZ '2026-08-01 00:00:00+00')
ORDER BY primary_email;

Who holds which admin role: join role assignments to role names and to the assignee's user record (users are matched on their immutable ID)

SELECT r.role_name, u.primary_email, a.scope_type
FROM google.workspace.role_assignments() AS a
JOIN google.workspace.roles() AS r USING (role_id)
LEFT JOIN google.workspace.users() AS u ON u.id = a.assigned_to
ORDER BY r.role_name, u.primary_email;
Link

Credentials

The 2 secret types google declares, as reported by the worker itself.

google_service_account

How to get these credentials

Google service-account credential (default auth for google_sheet / google_drive / google_calendar / google_call): the JSON key in key_json, optional subject for domain-wide delegation, optional scopes (space/comma list).

secret.sql
CREATE SECRET google_service_account (
    TYPE google_service_account,
    key_json '<GOOGLE_SERVICE_ACCOUNT_KEY_JSON>',  -- secret
    subject  '<subject>',
    scopes   '<scopes>'
);
Key Type Required Description
key_json secret VARCHAR — Full JSON key file of the service account (IAM & Admin > Service Accounts > Keys)
subject VARCHAR — Optional user email to impersonate via domain-wide delegation
scopes VARCHAR — Optional OAuth scopes, space- or comma-separated; defaults per API

The worker doesn't mark which keys are required.

Needed by usersgroupsgroup_membersorg_unitsdomainsrolesrole_assignmentschromeos_devicesmobile_devicesactivitiesusage_reportsalerts and 6 more functions

google_api_key

How to get these credentials

Google API key for public-data APIs (google_youtube, public Sheets, google_call on keyed public APIs).

secret.sql
CREATE SECRET google_api_key (
    TYPE google_api_key,
    api_key '<GOOGLE_API_KEY_API_KEY>'  -- secret
);
Key Type Required Description
api_key secret VARCHAR — API key from Google Cloud console > APIs & Services > Credentials

The worker doesn't mark which keys are required.

Needed by usersgroupsgroup_membersorg_unitsdomainsrolesrole_assignmentschromeos_devicesmobile_devicesactivitiesusage_reportsalerts and 6 more functions

Create the secret in the same session, after attaching google — the worker registers its secret types at ATTACH. Keys marked secret are masked in duckdb_secrets(); angle-bracket values are placeholders. Read credentials from your environment or secret store in your application and pass them through your SQL client’s parameter bindings. Keep real values out of saved SQL and history. Native DuckDB and Haybarn do not provide a SQL getenv() function.

Try these queries

Discover the Sheets API's reachable versions via the Discovery Service.

SELECT name, version, title
FROM google.main.google_apis()
WHERE name LIKE '%sheets%'
ORDER BY name
LIMIT 5

Uses google_apis

Browse the Drive v3 methods you can invoke through google_call.

SELECT method, http_method
FROM google.main.google_methods('drive', 'v3')
ORDER BY method
LIMIT 5

Uses google_methods

Read a header sheet range, projecting a named column from each row.

SELECT row_number, record ->> '$.name' AS name
FROM google.main.google_sheet('1AbC...', 'Sheet1!A1:Z', header := true)
WHERE row_number <= 100
ORDER BY row_number

Uses google_sheet

Search YouTube for 'duckdb' videos and project their view counts.

SELECT video_id, title, view_count
FROM google.main.google_youtube('duckdb', count := 25)

Uses google_youtube

Find Drive PDFs not yet recorded in a tracking sheet: anti-join google_drive against a google_sheet log tab whose file_id column holds the IDs already logged, newest first

SELECT f.id, f.name, f.modified_time
FROM google.main.google_drive(query := "mimeType='application/pdf' and trashed=false", count := 500) AS f ANTI
JOIN google.main.google_sheet('1AbC...', 'Log!A1:B', header := true) AS l ON l.record ->> '$.file_id' = f.id
ORDER BY f.modified_time DESC, f.id

Uses google_drivegoogle_sheet

Meeting load per team for April 2026: join timed primary-calendar events to a roster sheet (email, team) on the organizer e-mail, case-insensitively; organizers missing from the roster are grouped as '(not on roster)'

SELECT coalesce(r.record ->> '$.team', '(not on roster)') AS team,
  count(*) AS events,
  sum(date_diff('minute', e.start_time, e.end_time)) AS meeting_minutes
FROM google.main.google_calendar(calendar_id := 'primary', time_min := '2026-04-01', time_max := '2026-05-01') AS e
LEFT JOIN google.main.google_sheet('1AbC...', 'Roster!A1:B', header := true) AS r ON lower(r.record ->> '$.email') = lower(e.organizer)
WHERE NOT e.all_day
GROUP BY ALL
ORDER BY meeting_minutes DESC, team

Uses google_calendargoogle_sheet

38 more examples in the Catalog, each listed under the table or function it uses.

Questions it can answer

Plain-English questions from the worker's agent test tasks. An AI agent with this catalog attached should answer each one with SQL.

  • Using the google_apis discovery function, find the reachable Google API whose name is exactly 'sheets'. Return only its name, version and title columns.
  • List up to 25 Google Drive files whose MIME type is 'application/pdf', returning their id and name. (Requires a configured Google secret.)
  • List up to 20 events from the primary Google Calendar, returning the id, summary and start_time columns. (Requires a configured Google secret.)
  • Search YouTube for videos matching 'duckdb', ordered by view count, and return the title and view_count of the top 10. (Requires a configured Google secret.)
  • List the email of every OWNER of the Google group '[email protected]', ordered by email. (Requires a Workspace admin credential.)
  • List every organizational unit's org_unit_path in the Workspace tenant, ordered by org_unit_path. (Requires a Workspace admin credential.)

Google APIs is an independent open-source connector from Query.Farm. It is not affiliated with, endorsed by or sponsored by the services, projects or organisations it works with. Product names, logos and trademarks belong to their respective owners.