---
title: "How to Read and Write Data with the Google Sheets API"
url: "https://getknit.dev/blog/how-to-read-and-write-data-google-sheets-api/"
date: "2026-11-03T11:37:08+00:00"
modified: "2026-11-03T11:37:08+00:00"
type: "post"
---

# How to Read and Write Data with the Google Sheets API

[Blog](https://getknit.dev/blog) / [Tutorials](https://getknit.dev/blogs/tutorials/) / How to Read and Write Data with the Google Sheets API [Tutorials](https://getknit.dev/blogs/tutorials/) · November 3, 2026 

How to Read and Write Data with the Google Sheets API
=====================================================

 ![](https://storage.googleapis.com/knit-website-media/2026/08/64c34c8eb1ffc79e7f787ecd_Akshat-3-112x112.png)Akshat Jain

6 min read

 

 

 [](https://www.linkedin.com/sharing/share-offsite/?url=https%3A%2F%2Fgetknit.dev%2Fblog%2Fhow-to-read-and-write-data-google-sheets-api%2F) [](https://twitter.com/intent/tweet?url=https%3A%2F%2Fgetknit.dev%2Fblog%2Fhow-to-read-and-write-data-google-sheets-api%2F&text=How%20to%20Read%20and%20Write%20Data%20with%20the%20Google%20Sheets%20API)  

 

 

 

  Table of Contents - [Setup and Authentication](#setup-and-authentication)
- [Reading Metadata and Handling Pagination](#reading-metadata-and-handling-pagination)
- [Reading Data Ranges: values.get and batchGet](#reading-data-ranges-values-get-and-batchget)
- [Writing Data: update, append, and batchUpdate](#writing-data-update-append-and-batchupdate)
- [Google Sheets API Limits and Handling 429 Errors](#google-sheets-api-limits-and-handling-429-errors)
- [Frequently Asked Questions](#frequently-asked-questions)
- [How do I read and write data ranges using the Google Sheets API?](#how-do-i-read-and-write-data-ranges-using-the-google-sheets-api)
- [How do I append a new row programmatically?](#how-do-i-append-a-new-row-programmatically)
- [What are the Google Sheets API read/write quotas?](#what-are-the-google-sheets-api-read-write-quotas)
- [How do I handle 429 Too Many Requests errors?](#how-do-i-handle-429-too-many-requests-errors)
- [How do I paginate through a large spreadsheet using the API?](#how-do-i-paginate-through-a-large-spreadsheet-using-the-api)
 
  The Google Sheets API is a RESTful interface that lets you read and modify a spreadsheet’s data. Engineers build integrations to read cell values, append rows, and run batch updates across workspaces. This Google Sheets API tutorial explains the core spreadsheets and values endpoints, reading and writing data ranges, and managing usage quotas.

**Key Takeaways**

- The API uses the base URL `https://sheets.googleapis.com/v4/` and requires OAuth 2.0 authentication.
- Read operations do not use page tokens; developers must use specific ranges and batch methods.
- Google enforces limits of 300 read and 300 write requests per minute per project, and 60 of each per minute per user per project.

Setup and Authentication
------------------------

API access requires an authorization token passed via HTTP headers. To authenticate, you must create one or more OAuth 2.0 Client IDs. According to [Google’s own docs](https://developers.google.com/workspace/sheets/api/quickstart/go), a client ID is used to identify a single app to Google’s OAuth servers.

The service relies on the base URL `https://sheets.googleapis.com/v4/`. Authentication is managed by adding an `Authorization` header with a bearer token to each API request. For complete setup steps, read our guide on Google Sheets API authentication.

> **With Knit:** [Embed Knit’s auth component](https://developers.getknit.dev/docs/concepts#how-knit-works) so your users can authorize integrations without leaving your product.

Reading Metadata and Handling Pagination
----------------------------------------

The API requires a different approach for reading spreadsheet properties versus cell data. You use the `GET https://sheets.googleapis.com/v4/spreadsheets/{spreadsheetId}` endpoint and pass a `fields` parameter to filter the returned metadata.

When handling large datasets, be aware that there are no page tokens on `values.get`. You cannot use standard cursor pagination. Instead, you use specific A1 ranges, `spreadsheets.get` fields masks, and `batchGet` to retrieve data efficiently without overloading the application.

Reading Data Ranges: values.get and batchGet
--------------------------------------------

Retrieving cell data requires specifying the exact sheet and cells. The [Google Sheets API reference](https://developers.google.com/workspace/sheets/api/reference/rest/v4/spreadsheets.values/get) defines the endpoint to get spreadsheet values using an HTTP request: `GET https://sheets.googleapis.com/v4/spreadsheets/{spreadsheetId}/values/{range}`.

The path parameters are `spreadsheetId`, which is the string ID of the spreadsheet to retrieve data from, and `range`, which is the A1 notation or R1C1 notation of the range to retrieve values from. To fetch multiple distinct ranges simultaneously, use the `GET https://sheets.googleapis.com/v4/spreadsheets/{spreadsheetId}/values:batchGet` endpoint.

Here is a curl example for reading a range:

```bash
curl \
  'https://sheets.googleapis.com/v4/spreadsheets/{spreadsheetId}/values/Sheet1!A1:D5' \
  --header 'Authorization: Bearer <access_token>' \
  --header 'Accept: application/json'

```

You can also write Python scripts using the `requests` library to fetch these exact URLs.

Writing Data: update, append, and batchUpdate
---------------------------------------------

Modifying a spreadsheet involves targeting specific ranges or pushing bulk edits. When you write to Google Sheets API endpoints, modifying an existing range requires the `PUT https://sheets.googleapis.com/v4/spreadsheets/{spreadsheetId}/values/{range}` endpoint and a `valueInputOption` parameter to determine how input data is parsed. `RAW` stores values as-is, while `USER_ENTERED` parses them as if a user typed them into the UI. To add new data at the end of a sheet, a Google Sheets API append row operation requires the `POST https://sheets.googleapis.com/v4/spreadsheets/{spreadsheetId}/values/{range}:append` endpoint. The API searches the input range for existing data to find a table and adds the new values after the table’s last row, starting from its first column. The `insertDataOption` parameter controls how the new data lands: `OVERWRITE` writes over existing data in the areas it is written, while `INSERT_ROWS` inserts rows for the new data.

Here is a curl example for appending a row:

```bash
curl -X POST \
  'https://sheets.googleapis.com/v4/spreadsheets/{spreadsheetId}/values/Sheet1!A1:D1:append?valueInputOption=USER_ENTERED&insertDataOption=INSERT_ROWS' \
  --header 'Authorization: Bearer <access_token>' \
  --header 'Content-Type: application/json' \
  --data '{"values": [["Jane Doe", "jane@example.com", "2026-11-03"]]}'

```

The request body is a `ValueRange` resource, and its `values` field is an array of arrays: each inner array is one row, and each item in it is one cell.

For bulk edits, the [official reference](https://developers.google.com/workspace/sheets/api/reference/rest/v4/spreadsheets.values/batchUpdate) states the `values:batchUpdate` endpoint is an HTTP request: `POST https://sheets.googleapis.com/v4/spreadsheets/{spreadsheetId}/values:batchUpdate`.

Google Sheets API Limits and Handling 429 Errors
------------------------------------------------

Google enforces usage quotas on all API requests. These limits are specific to Google Sheets.

According to the [usage limits page](https://developers.google.com/workspace/sheets/api/limits), read requests are limited to 300 per minute per project and 60 per minute per user per project. Write requests have the same limits: 300 per minute per project and 60 per minute per user per project. If your app sends 350 requests in one minute, the additional 50 requests exceed the quota and generate a 429: Too many requests HTTP status code response.

To handle a rate limit block, implement exponential backoff with jitter. For architecture patterns on managing these constraints, read our guide on [API rate limiting best practices](https://getknit.dev/blog/10-best-practices-for-api-rate-limiting-and-throttling/).

```python
import time
import random
import requests

def get_sheet_with_backoff(url, headers):
    for n in range(5):
        response = requests.get(url, headers=headers)
        if response.status_code != 429:
            return response
        
        sleep_time = (2 ** n) + random.uniform(0, 1)
        time.sleep(sleep_time)
    return None

```

Frequently Asked Questions
--------------------------

### How do I read and write data ranges using the Google Sheets API?

You read data by sending a GET request to the `values.get` endpoint with the spreadsheet ID and A1 notation range. You write data using POST or PUT requests to endpoints like `values.update` or `values:batchUpdate`.

### How do I append a new row programmatically?

You send a POST request to the `values.append` endpoint with a `valueInputOption` and a request body whose `values` field holds the row. Use the `insertDataOption` parameter to choose between `OVERWRITE` and `INSERT_ROWS`.

### What are the Google Sheets API read/write quotas?

Read and write requests are each limited to 300 per minute per project and 60 per minute per user per project.

### How do I handle 429 Too Many Requests errors?

You handle a 429 HTTP status code by pausing your script. Implement an exponential backoff algorithm with jitter to wait before retrying the failed request.

### How do I paginate through a large spreadsheet using the API?

The API does not offer page tokens for cell values. You handle large datasets by requesting specific A1 ranges, using the `spreadsheets.get` fields masks to check sheet boundaries, and making `batchGet` calls.

To start building, check the provider’s docs and set up your OAuth credentials.

Building integrations into your product?

Knit gives you three ways to build them. Pick the one that fits.

- [Unified API](/products/unified-api/)
    
    Your customers use many tools in one category (HRIS, ATS, CRM, accounting). Build one integration and get normalised read and write data with real-time webhooks.
    
    [Try free](https://dashboard.getknit.dev/signup)
- [Integrations Agent](/products/integrations-agent/)
    
    You need one specific workflow. Describe it in plain English and get production-ready code, not fixed iPaaS blocks.
    
    [Try free](https://agent.getknit.dev/)
- [MCP Servers](/products/mcp-servers/)
    
    Your AI agent needs to read and act in your customers' apps. Use pre-built, hosted MCP servers instead of writing integration code.
    
    [Try free](https://mcphub.getknit.dev/)

Knit's Unified API connects to 190+ apps across HRIS, ATS, CRM, accounting and more.

Knit never stores your end users' data and is SOC 2, GDPR and ISO 27001 compliant: [How Knit handles security](/security/) · [Security Center](https://compliance.getknit.dev/)

Not sure which fits? [Talk to a human](/book-demo/)

 

 ![](https://storage.googleapis.com/knit-website-media/2026/08/64c34c8eb1ffc79e7f787ecd_Akshat-3-112x112.png)Written by Akshat Jain

Coding chaos into innovation and building from zero to scale

 

 

 

 

 

  Keep Reading
------------

  ![How to Build a Google Calendar API Integration for B2B SaaS](https://storage.googleapis.com/knit-website-media/2026/08/blog-banner-red-scaled-640x400.png) [Tutorials](https://getknit.dev/blogs/tutorials/) 

### [How to Build a Google Calendar API Integration for B2B SaaS](https://getknit.dev/blog/how-to-build-a-google-calendar-api-integration/)

B2B SaaS engineers build a Google calendar integration to power scheduling tools, synchronize events, and automate meeting workflows for their…

 October 29, 2026 · 7 min read 

 

   ![How to Get an Okta API Token (Step-by-Step)](https://storage.googleapis.com/knit-website-media/2026/08/blog-banner-red-scaled-640x400.png) [Tutorials](https://getknit.dev/blogs/tutorials/) 

### [How to Get an Okta API Token (Step-by-Step)](https://getknit.dev/blog/okta-api-key/)

Generate an Okta API token in the Admin Console, add it as an SSWS Authorization header, and call the Okta…

 July 22, 2026 · 8 min read 

 

   ![Get Ticket Data from Freshdesk API using Python](https://storage.googleapis.com/knit-website-media/2026/08/blog-banner-red-scaled-640x400.png) [Tutorials](https://getknit.dev/blogs/tutorials/) 

### [Get Ticket Data from Freshdesk API using Python](https://getknit.dev/blog/get-ticket-data-from-freshdesk-api-using-python/)

Learn how to retrieve ticket data from the Freshdesk API with step-by-step instructions, endpoints, code examples, common pitfalls, and FAQs…

 April 11, 2026 · 5 min read 

 

  

 

  \#1 in Ease of Integrations
---------------------------

![4.9 out of 5 stars](/wp-content/themes/knit/assets/images/g2/g2-star-rating.svg)

4.9 out of 5 stars on G2

![G2 Leader, Spring 2026](/wp-content/themes/knit/assets/images/g2/g2-leader.svg)![G2 Fastest Implementation, Spring 2026](/wp-content/themes/knit/assets/images/g2/g2-fastest-implementation.svg)![G2 High Performer, Spring 2026](/wp-content/themes/knit/assets/images/g2/g2-high-performer.svg)![G2 Best Est. ROI, Spring 2026](/wp-content/themes/knit/assets/images/g2/g2-best-roi.svg)

 

  Put Integrations on Autopilot. Talk to Experts.
-----------------------------------------------

Knit is loved by customers across the globe due to our seamless product and white glove support. You'll love us too!

 [Talk to a Human](/book-demo)
