# Generate TypeScript types from a Google Sheet

Paste a Google Sheet URL and get a TypeScript interface describing a row — property names taken from your header row, property types inferred from the values underneath them.

*Last updated: 2026-07-14 · Source: <https://pastesheet.com/tools/google-sheets-to-typescript>*

## Using this without the browser

This page hosts an interactive tool: at <https://pastesheet.com/tools/google-sheets-to-typescript> you paste a Google Sheet URL and it returns the result in the page. There is nothing to install and no account required.

If you are an agent or a script and need this programmatically instead, connect the sheet once as a PasteSheet endpoint and read it over HTTP — the endpoint returns the same rows as JSON, stays in sync with the sheet, and needs no Google credentials:

```bash
curl 'https://pastesheet.com/api/your-endpoint-id?limit=10'
```

The same endpoint is also a read-only MCP server at `https://pastesheet.com/mcp/sheets/your-endpoint-id`, exposing `list_tabs`, `get_schema` and `query_rows`. See <https://pastesheet.com/guides/google-sheets-mcp.md>.

## Key facts

- Google's API requires a **Google Cloud project plus OAuth credentials or a service account** before it will return a single row. ([source](https://developers.google.com/workspace/sheets/api/guides/authorizing))
- Google's Sheets API is **cell-oriented**: it reads ranges like `A1:D50`, not records. Reassembling those into row objects is work you do yourself. ([source](https://developers.google.com/workspace/sheets/api/limits))
- The Google Sheets API allows **300 read requests per minute per project** and **60 per minute per user**. Past that it returns `429 RESOURCE_EXHAUSTED`. ([source](https://developers.google.com/workspace/sheets/api/limits))
- It needs **no Google Cloud project, no OAuth consent screen and no service-account JSON**. You paste a share URL, and MCP is included on the Free plan.

## How to generate types from a Google Sheet

1. In Google Sheets, click **Share**, then set General access to **Anyone with the link** (Viewer is enough). If you skip this, the tool cannot read the sheet — [check whether yours is public](https://pastesheet.com/tools/google-sheet-public-checker).
2. Copy the sheet URL from your browser's address bar. To use one specific tab, open that tab first so its `gid` ends up in the URL.
3. Paste it above. Each header becomes a property; each column's values are scanned to infer its type.
4. Copy the interface into your project.

## What the output looks like

```typescript
export interface SheetRow {
  name: string;
  role: string;
  headcount: number;
  active: boolean;
  "Start Date": string;
}
```

## How the types are inferred

The same column-type inference PasteSheet runs when you connect a sheet as an endpoint:

- Every value in the column parses as a number → `number`.
- Every value is a boolean-ish token (`true`/`false`, `yes`/`no`, `1`/`0`) → `boolean`.
- Every value parses as a date → `string`, because a date crossing JSON is a string, not a `Date`.
- Anything else, or a mixed column → `string`.
- A header that is not a valid TypeScript identifier is emitted as a quoted property — `Start Date` becomes `"Start Date"` rather than a syntax error. The header is never renamed for you, because the key you get back in the JSON is the header.

## Types describe a shape — they do not fetch it

An interface tells your compiler what a row looks like. It does not get you the rows. For that you still need something to read the sheet at runtime, which is the part that normally means a Google Cloud project and a service account.

A PasteSheet endpoint gives you a plain JSON URL to `fetch()`, so the interface above and the data it describes come from the same place — and the endpoint watches the sheet's schema, so if someone renames a column the types you generated do not silently start lying. See the [React guide](https://pastesheet.com/guides/read-google-sheet-in-react).

## What a live endpoint costs

**Nothing, to start.** The Free plan gives you 3 endpoints and 2,000 requests a month, with MCP included and no credit card. The tool above stays free and unlimited either way.

**Free — $0/month.** For side projects and trying things out.

- Endpoints: 3
- Requests: 2,000 / month
- Rows per endpoint: 500
- Tabs per endpoint: 1
- Rate limit: 60 / minute

## Frequently asked questions

### Does my Google Sheet need to be public?

It needs to be readable by anyone with the link. In Google Sheets, click Share and set General access to "Anyone with the link". A sheet left as "Restricted" cannot be read by this tool, or by anything else that has not been explicitly granted access to it.

### Can I use one specific tab?

Yes. Open the tab you want in Google Sheets and copy the URL from the address bar — it will contain a gid parameter identifying that tab. Paste that URL and the tool reads that tab rather than the first one.

### Do you store my sheet or its data?

No. The rows are fetched, converted and handed back to you. The result is cached for about a minute so that a reload does not re-hit Google, and then it is gone. Nothing is written to a database and nothing is shared with anyone.

### Why is a date column typed as string?

Because that is what you actually receive. JSON has no date type, so a date crosses the wire as a string and arrives in your code as a string. Typing it as Date would be a lie your compiler would happily believe until it crashed at runtime.

### What happens to a column name with a space in it?

It is emitted as a quoted property — "Start Date": string — which is valid TypeScript and preserves the real key you will get back in the JSON. Silently rewriting it to startDate would produce an interface that quietly does not match the data.

## Sources

- [Authorize requests — Google Sheets API](https://developers.google.com/workspace/sheets/api/guides/authorizing) — Google
- [Usage limits — Google Sheets API](https://developers.google.com/workspace/sheets/api/limits) — Google
- [Publish a file from Google Docs, Sheets, Slides or Forms](https://support.google.com/docs/answer/183965) — Google Docs Editors Help

## Related tools

- [Free Google Sheets to JSON Converter](https://pastesheet.com/tools/google-sheets-to-json) — Paste a public Google Sheet URL and get clean, formatted JSON instantly. No signup, no API key, and no Google Cloud project. Copy it, download it, or go live.
- [Google Sheets to SQL INSERT Generator](https://pastesheet.com/tools/google-sheets-to-sql) — Turn a Google Sheet into a CREATE TABLE plus INSERT statements you can run straight into MySQL, Postgres, or SQLite. Free, no signup, quotes escaped properly.
- [Is My Google Sheet Public? Free Checker](https://pastesheet.com/tools/google-sheet-public-checker) — Paste a Google Sheet URL to check whether it is publicly readable. See exactly what an app, script, or API sees — and get the fix if the sheet is still private.

---

[PasteSheet](https://pastesheet.com) turns any Google Sheet into a live REST API and MCP server for AI agents — no backend, no code. Canonical HTML version of this page: <https://pastesheet.com/tools/google-sheets-to-typescript>
