Skip to content

Add a Google Sheets template generated from Google's API description - #325

Merged
tnkuehne merged 2 commits into
feat/google-calendar-templatefrom
feat/google-sheets-template
Nov 23, 2026
Merged

tnkuehne merged 2 commits into
feat/google-calendar-templatefrom
feat/google-sheets-template

Conversation

@tnkuehne

@tnkuehne tnkuehne commented Nov 23, 2026 •

Copy link
Copy Markdown
Contributor

Why

Spreadsheets are a common source and target for internal apps, and no template covers Google Sheets yet. Like Calendar, it only needs rules on top of the discovery generator.

What changes

Google Sheets template (templates/google-sheets)

  • Methods: all 17 methods of the Google Sheets API as typed methods with field selections: get, create and batchUpdate for spreadsheets, valuesGet/valuesUpdate/valuesAppend/valuesClear and their batch and data-filter variants, sheetsCopyTo, and developer metadata. None is left out.
  • Approvals: each user's approval level decides when a method asks.
    • Writing, appending and clearing cells, and batchUpdate, which can change or delete sheets, ask at the default level.
    • valuesAppend counts as an update: with insertDataOption: "OVERWRITE", the default, it can overwrite cells below a table.
    • Creating a spreadsheet and copying a sheet into one run at once.
    • The data-filter reads and developerMetadataSearch read through a POST and never ask.
  • Scope: only https://www.googleapis.com/auth/spreadsheets, not Drive. An account connected with fewer scopes gets permission_required.
  • OAuth: the organization's own Google OAuth client only, like Gmail and Calendar.
  • Results: sheets_error carries Google's message, status and reasons. Rate limits, missing scopes, revoked tokens and responses over 8 MiB are handled like in the other Google templates.
  • Icon: a plain spreadsheet icon, not Google's logo.
  • template.md describes setup, A1 ranges, selections, approvals, results and how to regenerate.

Generator

  • Scopes in the rules: discovery rules can name the scopes to request. Every Sheets method also accepts Drive's scopes, and on a tie the smallest covering set chose drive, which is full Drive access. The generator checks that every offered method accepts one of the named scopes.

  • Required parameters: discovery rules can require parameters that a description leaves optional. Sheets requires valueInputOption for valuesUpdate and valuesAppend, and the runtime rejects a missing required query parameter before sending.

Template checks

  • Network origins: a new test checks that every template allows the origins it calls and documents the same list in template.md. It found that the Sheets template left out https://sheets.googleapis.com, which is now declared.

Lint

  • Generated api.ts files: no-shape-in-symbol-names is off for them. They must keep the provider's field names, such as Sheets' shape.

Connection page

New page, connected state, with the same approval form as the other templates.

1280 px 390 px

Testing

  • pnpm check
  • Generator: a test for named scopes, including the stop when a method doesn't accept them.
  • Sheets template against a mocked Google:
    • typed requests with fields URLs, encoded ranges and undefined arguments left out;
    • writes asking first;
    • creating running at once and asking at all_changes;
    • data-filter reads never asking;
    • each approval level;
    • Google errors, rate limits and missing scopes;
    • oversized responses;
    • token refresh, outages and callback checks.
  • Type tests: the README example compiles; unknown fields, missing selections, a missing range and wrong choices don't.
  • Catalog tests: pass with the new template.
  • Not tested against a live Google account.

RetriggerView in GreptileConfidence Score: 5/5 Tier: apex

The PR appears safe to merge; no new blocking issue was found.

Summary

Adds a Google Sheets template with 17 typed methods, personal Google connections and per-user approvals.

  • Google Sheets calls return selected data and ask before changes.
  • Users can connect their Google account to a Sheets app.
  • Google API templates can choose scopes and require query values.
  • Template checks compare called network origins with allowed origins.

Diagram

%%{init: {'theme': 'neutral'}}%%
flowchart TD
  A["Typed Sheets method"] --> B["Check arguments and selected fields"]
  B --> C{"Does this change need approval?"}
  C -->|Yes| D["Ask or check the user's answer"]
  D -->|Accepted| E["Load the current user's token"]
  D -->|Declined| F["Return declined"]
  C -->|No| E
  E --> G["Call Google Sheets"]
  G --> H["Limit response size and return the result"]
Loading

Reviews (15) · Last reviewed commit: "Allow the Sheets API origin and require ..." · Reviewed by Greptile

@tnkuehne
tnkuehne added this pull request to stack #320 November 23, 2026 00:41
@cloudflare-workers-and-pages

cloudflare-workers-and-pages Bot commented Nov 23, 2026 •

Copy link
Copy Markdown

Deploying with  Cloudflare Workers  Cloudflare Workers

The latest updates on your project. Learn more about integrating Git with Workers.

Status Name Latest Commit Updated (UTC)
✅ Deployment successful!
View logs
widefleet-docs ae757f8 Nov 23 2026, 10:35 AM

@tnkuehne
tnkuehne force-pushed the feat/google-sheets-template branch from 4509ada to b3f8369 Compare November 23, 2026 00:46
Comment thread templates/google-sheets/widefleet.jsonc Resolved
Comment thread templates/google-sheets/src/api.ts Resolved
@tnkuehne
tnkuehne force-pushed the feat/google-sheets-template branch 2 times, most recently from 90bd42a to 52a5295 Compare November 23, 2026 01:08
@tnkuehne
tnkuehne force-pushed the feat/google-sheets-template branch from 52a5295 to 96908a9 Compare November 23, 2026 01:20
@tnkuehne
tnkuehne force-pushed the feat/google-sheets-template branch from 96908a9 to cc46f15 Compare November 23, 2026 01:31
@tnkuehne
tnkuehne force-pushed the feat/google-sheets-template branch from cc46f15 to f8615b6 Compare November 23, 2026 01:43
@tnkuehne
tnkuehne force-pushed the feat/google-sheets-template branch from f8615b6 to 884c780 Compare November 23, 2026 02:01
@tnkuehne
tnkuehne force-pushed the feat/google-sheets-template branch 2 times, most recently from 6ec6f98 to c4e410f Compare November 23, 2026 08:32
@tnkuehne
tnkuehne force-pushed the feat/google-sheets-template branch from c4e410f to 00f7f71 Compare November 23, 2026 09:16
@tnkuehne
tnkuehne force-pushed the feat/google-sheets-template branch from 00f7f71 to 72bc4af Compare November 23, 2026 09:24
@tnkuehne
tnkuehne force-pushed the feat/google-sheets-template branch from 72bc4af to 26c8ea2 Compare November 23, 2026 09:33
@tnkuehne
tnkuehne force-pushed the feat/google-sheets-template branch from 26c8ea2 to 0668d85 Compare November 23, 2026 10:05
@tnkuehne
tnkuehne force-pushed the feat/google-sheets-template branch from 0668d85 to 8f7d340 Compare November 23, 2026 10:16
The new template offers every method of the Google Sheets API as a typed
method with field selections, generated like the Gmail and Calendar
templates: cell values, spreadsheets, sheets, formatting and developer
metadata.

Writing, appending and clearing cells and batchUpdate ask for approval by
each user's level; creating a spreadsheet runs at once. Discovery rules can
name the scopes to request: every Sheets method also accepts Drive's scopes,
and the smallest covering set would have chosen full Drive access. Generated
API files may use the provider's field names, such as shape.
The Sheets template calls sheets.googleapis.com, which its network list
left out, so every request would have been blocked. A test now checks that
each template allows the origins it calls and documents the same list.
Discovery rules can require parameters that a description leaves optional:
Sheets writes need valueInputOption, which the runtime checks before
sending.
@tnkuehne
tnkuehne force-pushed the feat/google-sheets-template branch from 8f7d340 to ae757f8 Compare November 23, 2026 10:33
@tnkuehne
tnkuehne merged commit 552a977 into main Nov 23, 2026
15 checks passed
@tnkuehne
tnkuehne deleted the feat/google-sheets-template branch November 23, 2026 10:49
tnkuehne added a commit that referenced this pull request Nov 23, 2026
#324)

## Why

Google Calendar is one of the most requested integrations, and none of
the templates covers it yet. Google publishes a Discovery document for
it, which the generator from #319 already reads. A calendar template
therefore needs only its rules and the template code around the
generated API.

## What changes

**Google Calendar template** (`templates/google-calendar`)

- **Methods:** all 38 methods of the Google Calendar API as typed
methods with field selections: events and recurring instances,
calendars, the calendar list, sharing (ACL), settings, colors, free/busy
times, and push notification channels. None is left out.
- **Approvals:** each user's approval level decides when a method asks,
as in the other templates.
- `eventsInsert` is `send`: it adds the event to its guests' calendars
and, with `sendUpdates`, emails them.
  - Quick-add, imported private copies and new calendars are `create`.
- Changing, moving, sharing, clearing and deleting are updates or
deletions.
- **Scope:** `https://www.googleapis.com/auth/calendar`, which covers
every method. An account connected with fewer scopes gets
`permission_required`.
- **OAuth:** the organization's own Google OAuth client only
(`GOOGLE_CLIENT_ID`/`GOOGLE_CLIENT_SECRET`), like Gmail. The scope is
sensitive, so a managed client would need Google's verification.
- **Results:** `calendar_error` carries Google's message, status and
reasons. Rate limits, missing scopes, revoked tokens and responses over
8 MiB are handled as in Gmail.
- **Icon:** a plain calendar icon, not Google's logo.
- `template.md` describes setup, method names, selections, approvals,
results and how to regenerate.

**Generator**

- **`read` rule:** discovery rules accept `read` for methods that only
read through a POST, such as `freebusy.query`. Those methods never ask.

**Catalog tests**

- **Template list:** the catalog tests compare against the template
directories in the repository instead of a fixed list of four, so adding
a template doesn't change them.

## Connection page

New page, connected state, with the same approval form as the other
templates.

| 1280 px | 390 px |
| --- | --- |
| <img
src="https://gist.githubusercontent.com/tnkuehne/2e857c8b70cfc0a62168609f2702355e/raw/90e74caf0ea6221c430b0094bd0ff5df4120a8f7/calendar-after-1280.png"
width="400"> | <img
src="https://gist.githubusercontent.com/tnkuehne/2e857c8b70cfc0a62168609f2702355e/raw/90e74caf0ea6221c430b0094bd0ff5df4120a8f7/calendar-after-390.png"
width="200"> |

## Testing

- `pnpm check`
- **Generator:** a test for the `read` rule.
- **Calendar template against a mocked Google:**
- typed requests with `fields` URLs and `undefined` arguments left out;
  - invitations asking as `send`;
  - quick-add running at once by default and asking at `all_changes`;
  - `freebusyQuery` never asking;
  - each approval level;
  - Google errors, rate limits and missing scopes;
  - oversized responses;
  - token refresh, outages and callback checks.
- **Type tests:** the README example compiles; unknown fields, missing
selections, a missing calendar and wrong choices don't.
- **Catalog and template install tests:** pass with the new template.
- Not tested against a live Google account.






























<!-- greptile_comment -->

<!-- greptile_summary -->

<h2><a
href="https://app.greptile.com/api/retrigger?id=116075280&amp;sig=ae468be2d6b8b06c9cb9abfa21e52632275c8828c174e4745950025fe3243aad"><picture><source
media="(prefers-color-scheme: dark)"
srcset="https://greptile-static-assets.s3.amazonaws.com/badges/RetriggerDark.svg?v=2"><source
media="(prefers-color-scheme: light)"
srcset="https://greptile-static-assets.s3.amazonaws.com/badges/Retrigger.svg?v=2"><img
alt="Retrigger"
src="https://greptile-static-assets.s3.amazonaws.com/badges/Retrigger.svg?v=2"
align="right"></picture></a><a
href="https://app.greptile.com/-/switch-tenant?tenant=mendra&amp;next=%2Fwidefleet%2Fwidefleet%2Fpull%2F324&amp;utm_source=greptile_review&amp;utm_medium=github&amp;utm_campaign=view_in_greptile"><picture><source
media="(prefers-color-scheme: dark)"
srcset="https://greptile-static-assets.s3.amazonaws.com/badges/ViewInGreptileDark.svg?v=2"><source
media="(prefers-color-scheme: light)"
srcset="https://greptile-static-assets.s3.amazonaws.com/badges/ViewInGreptile.svg?v=2"><img
alt="View in Greptile"
src="https://greptile-static-assets.s3.amazonaws.com/badges/ViewInGreptile.svg?v=2"
align="right"></picture></a>Confidence Score: 5/5 <sup><img alt="Tier:
apex" title="Review tier: apex"
src="https://greptile-static-assets.s3.amazonaws.com/badges/effort-apex.svg?v=3"
height="12"></sup></h2>

<!-- greptile-impact-verdict --> The PR appears safe to merge with the
required query-argument checks from dependent PR #325.

<details open><summary><h3>Summary</h3></summary>

Adds a personal Google Calendar template with 38 typed methods, field
selections and per-user approvals.

- Apps can connect a user's Google account and call typed Calendar
methods.
- The generator can include read-only methods that use POST.
</details>

<details open><summary><h3>Diagram</h3></summary>

```mermaid
%%{init: {'theme': 'neutral'}}%%
flowchart TD
  A["Calendar method"] --> B["Build request and field selection"]
  B --> C{"Changes data?"}
  C -- No --> F["Send with the user's Google token"]
  C -- Yes --> D{"Approval needed?"}
  D -- No --> F
  D -- Yes --> E["Ask the user"]
  E -- Accepted --> F
  E -- Declined --> G["Return declined"]
  F --> H["Return selected data or an error"]
```
</details>

<!-- greptile_confidence_score:5 -->

<sub>Reviews (15) · Last reviewed commit: ["Add a Google Calendar
template
generated..."](615a3e6)
· [Reviewed by
Greptile](https://www.greptile.com/?utm_source=greptile_review&utm_medium=github&utm_campaign=review_public&utm_content=widefleet/widefleet)</sub>

<!-- /greptile_comment -->
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant