The easiest way to use Google Sheet API
Tags: webdev, google, sheet, api
Published: 2020-05-14 12:38:14

---
title: The easiest way to use Google Sheet API
published: true
description: Setting up your Google Sheet API without any backend coding and any server setup in 2 minutes. Access, Update, Delete your google sheet data with a simple and secure API endpoint.
tags: webdev,google,sheet,API
---

Using Google Sheet API is very basic with NoCodeAPI. We make the process to access data from your google sheet is so easy and quick. Just authenticate with your Google account and rest we will do for you.

There are the following reasons we build this tool to **Save your Time** by building your backend.

- Write API endpoint with your framework(express, Django, Ruby on Rail, etc)
- Secure Access Token
- Maintain Server
- Config caching technology to make API faster
- Figure out complex documentation
- Build your own logs system to visualize your APIs
- Required more time to do all these things.

With **NoCodeAPI** you can access, update, and delete your google sheet data in 2 minutes with many built-in features:


### Setup Sheet API

I'm assuming that you already signup on <a href="https://nocodeapi.com" target="_blank">NoCodeAPI</a>. If not then first make an account there and activate Google Sheet API from Marketplace. Follow this article for a quick setup. <a href="https://nocodeapi.com/docs/google-sheets-nocode-api-docs">Setup Google Sheet API</a>

When you will finish your Google Sheet API then you will see this card with your sheet secure API endpoint.

![Google Sheet API Card](https://dev-to-uploads.s3.amazonaws.com/i/bvxj94dn7j4ut7aybxxm.png)

## Use API Endpoints:

With Google sheet API you can do:

- **Get rows** <small>(GET Request)</small>
- **Get single row** <small>(GET Request)</small>
- **Add new row** <small>(POST Request)</small>
- **Update a row** <small>(PUT Request)</small>
- **Delete a row** <small>(DELETE Request)</small>

**Note**: I'll use the CURL command for the demo.

In one Google spreadsheet, you can add multiple tabs, and first, you have to know the tab name of which you want to use API. On the bottom, you can see your all tab's names. In this image `api-database`, `lists` & `Sheet2` are **tabId**.

![Tab Names](https://dev-to-uploads.s3.amazonaws.com/i/ck8b5cqnljs0me7ef2gb.png)

### #Get rows

To get your sheet rows to make a `GET` call to your endpoint with `tabId` query params and it will return your data as `JSON`.

```json
curl https://v1.nocodeapi.com/betauser/google_sheets/mLjulmxwQuctZXNl?tabId=<tabId>
```

Here is the result that will be consoled as JSON.

```json
{
  "data": [
    {
      "row_id": 2,
      "name": "NoCodeAPI",
      "link": "https://nocodeapi.com",
      "description": "Quick and Easy API Gateway for your favorite Applications"
    },
    {
      "row_id": 3,
      "name": "Public APIs",
      "link": "https://public-apis.io",
      "description": "A collection of public APIs for software developers "
    }
  ],
  "total": 2
}
```

### #Get single row

To get a single row from sheet make a `GET` call to your endpoint with `tabId` & `row_id` query params and it will return single data object as `JSON`.

```json
curl https://v1.nocodeapi.com/betauser/google_sheets/mLjulmxwQuctZXNl?tabId=<tabId>&row_id=<row_id>
```

Here is a result you will get.

```json
{
  "row_id": 2,
  "name": "NoCodeAPI",
  "link": "https://nocodeapi.com",
  "description": "Quick and Easy API Gateway for your favorite Applications"
}
```

### #Add new row

To add a new row in your google sheet you have made a `POST` call with Array of rows into `body`

```json
curl --request POST "https://v1.nocodeapi.com/betauser/google_sheets/mLjulmxwQuctZXNl?tabId=<tabId>" \
-H "Content-Type: application/json" \
--data '[
  [
    "Producthunt",
    "https://producthunt.com",
    "A website to launch new products"
  ],
  [
    "Twitter",
    "https://twitter.com",
    "A Social networking plateform for peoples"
  ]
]'
```

When you hit this command into the terminal then you will get this message:

```json
{ "message": "Successfully Inserted" }
```

### #Update row

To update a row in your google sheet you have made a `PUT` call with object data into `body`

```json
curl --request PUT "https://v1.nocodeapi.com/betauser/google_sheets/mLjulmxwQuctZXNl?tabId=<tabId>" \
-H "Content-Type: application/json" \
--data-raw '{
  "row_id": 3,
  "name": "Producthunt 3",
  "link": "https://producthunt.com",
  "description": "A website to launch new products"
}'
```

When you hit this command into the terminal then you will get this message:

```json
{ "message": "Updated successfully" }
```

### #Delete row

To delete one row from your google sheet you have made a `DELETE` call with `tabId` & `row_id` query params.

```json
curl --request DELETE https://v1.nocodeapi.com/betauser/google_sheets/mLjulmxwQuctZXNl?tabId=<tabId>&row_id=<row_id>
```

When you hit this command into the terminal then you will get this message:

```json
{ "message": "Deleted successfully" }
```

We did it.

<em>Originally published at [nocodeapi.com](https://nocodeapi.com/google-sheet-api)</em>

Yes, That's all. If you have any other use cases then let us know about that. So, we can make a blog post about that.

More useful links:
- [Build Telegram Bot without code and get notifications](https://nocodeapi.com/telegram-bot-with-nocode-and-get-notifications)
- [Website Status Page with Uptime Robot & Zeit](https://nocodeapi.com/free-website-status-page-with-uptime-robot-and-zeit)
- [Collect website data with React & Airtable NoCodeAPI](https://nocodeapi.com/collect-website-data-with-react-and-airtable-nocodeapi)
- [Get User Leads data into Telegram](https://nocodeapi.com/get-user-leads-data-into-telegram)
- [More use cases](https://nocodeapi.com/use-cases)