Google Sheets API

Convert your Google Sheet into JSON API without coding

Overview

Base Endpoint

For Google Sheets API, the format of your endpoint ⤵️

https://v1.nocodeapi.com/<username>/google_sheets/<token>

- username- your nocodeapi username.

- token- every api have unique token. See your API card when you setup API.

API Error Codes:

If your query fails, API will return a 3-digit error-code and info as plain text

Error response example: If you provide a invalid key or do not send one, you will be responded with Unauthorised Access in below format.

{
    "error": 1,
    "code": 401,
    "info": "Unauthorized"
}

Common API Errors:

Code Info [affected API endpoints]
200 (OK)Standard response for successful GET, POST, UPDATE & DELETE
400 (Bad Request)Error response when creating (POST) or updating (UPDATE, DELETE).
401 (Unauthorized)Error response when wrong or invalid API key
402 (Payment Required)Returned if pro feature is tried to be accessed from free account
403 (Forbidden)Error response when action is forbidden by the user (API owner)
404 (No such route) Route is not valid or query params is in-valid.
429 (Rate limit exceeded)Your API request limit exceeded per month.
500 (Server error)Server error

API Endpoints

Get Records

Make the GET request on below endpoint with tabId query param to get all sheet data.

https://v1.nocodeapi.com/<username>/google_sheets/<token>?tabId=<tabId>

- Request Parameters:

ObjectDescription
tabId[Required] Your Sheet Tab name. (ex: Sheet1)
perPage[optional] Total number of records you want in one request.
page[optional] Page number
valueRenderOption[optional] Determines how values should be rendered in the output. FORMATTED_VALUE, UNFORMATTED_VALUE or FORMULA

- Code Examples

const axios = require('axios');
    
axios({
    method: 'get',
    url: 'https://v1.nocodeapi.com/<username>/google_sheets/<token>', 
    params: {tabId: '<tabId>'},
}).then(function (response) {
        // handle success
        console.log(response);
}).catch(function (error) {
        // handle error
        console.log(error);
})

Get single row

Make the GET request on below endpoint with tabId & row_id query param and you will get single row object from sheet.

https://v1.nocodeapi.com/<username>/google_sheets/<token>?tabId=<tabId>&row_id=2

- Request Parameters:

ObjectDescription
tabId[Required] Your Sheet Tab name. (ex: Sheet1)
row_id[Required] Your Sheet row number
valueRenderOption[optional] Determines how values should be rendered in the output. FORMATTED_VALUE, UNFORMATTED_VALUE or FORMULA

- Code Examples

const axios = require('axios');
    
axios({
    method: 'get',
    url: 'https://v1.nocodeapi.com/<username>/google_sheets/<token>', 
    params: {tabId: '<tabId>',row_id: '<row_id>'},
}).then(function (response) {
        // handle success
        console.log(response);
}).catch(function (error) {
        // handle error
        console.log(error);
})

Append new row

Make POST requeston below endpoint with array of array you want to push new row into your google sheet

https://v1.nocodeapi.com/<username>/google_sheets/<token>?tabId=<tabId>

[Required] body row array format ⤵️

[
    [
        "NoCodeAPI",
        "hello@nocodeapi.com"
    ],
    [
        "Mohd Danish",
        "mddanishyusuf@gmail.com"
    ]
]

- Code Examples

const axios = require('axios');
    
axios({
    method: 'post',
    url: 'https://v1.nocodeapi.com/<username>/google_sheets/<token>', 
    params: {tabId: '<tabId>'},
    data: [["NoCodeAPI","hello@nocodeapi.com"],["Mohd Danish","mddanishyusuf@gmail.com"]]
}).then(function (response) {
        // handle success
        console.log(response);
}).catch(function (error) {
        // handle error
        console.log(error);
})

Update row

Make PUT request on below endpoint with row new object with row_id

https://v1.nocodeapi.com/<username>/google_sheets/<token>?tabId=<tabId>

[Required] body row new object format ⤵️

{
    "row_id": 3,
    "name": "NoCodeAPI v2",
    "email": "hello@nocodeapi.com"
}

- Code Examples

const axios = require('axios');
    
axios({
    method: 'put',
    url: 'https://v1.nocodeapi.com/<username>/google_sheets/<token>', 
    params: {tabId: '<tabId>'},
    data: {"row_id":3,"name":"NoCodeAPI v2","email":"hello@nocodeapi.com"}
}).then(function (response) {
        // handle success
        console.log(response);
}).catch(function (error) {
        // handle error
        console.log(error);
})

Delete Rows

Make DELETE request on below endpoint with tabId and row IDs

https://v1.nocodeapi.com/<username>/google_sheets/<token>?tabId=<tabId>&row_id=2,3,4

- Request Parameters:

ObjectDescription
tabId[Required] Your Sheet Tab name. (ex: Sheet1)
row_id[Required] Your Sheet row numbers string. example: 2(delete single row) 2,3,4,5 (delete rows 2,3,4,5) or 2-3,7-9,11-16 (delete rows from 2-3, 7-9 and 11-16)

- Code Examples

const axios = require('axios');
    
axios({
    method: 'delete',
    url: 'https://v1.nocodeapi.com/<username>/google_sheets/<token>', 
    params: {tabId: '<tabId>',row_id: '2,3,4,5'},
}).then(function (response) {
        // handle success
        console.log(response);
}).catch(function (error) {
        // handle error
        console.log(error);
})

Make new Spreedsheet

Make POST request on below endpoint with to make new spreedsheet.

https://v1.nocodeapi.com/<username>/google_sheets/<token>/create

- Request Parameters:

ObjectDescription
title[optional] If you didn't pass title then by default Untitled spreadsheet will be created.

- Code Examples

const axios = require('axios');
    
axios({
    method: 'post',
    url: 'https://v1.nocodeapi.com/<username>/google_sheets/<token>', 
    params: {tabId: '<tabId>',row_id: '2,3,4,5'},
}).then(function (response) {
        // handle success
        console.log(response);
}).catch(function (error) {
        // handle error
        console.log(error);
})

Add Sheet Tab

Make POST request on below endpoint with tabId and sheetName to new tabs into your spreedsheet

https://v1.nocodeapi.com/<username>/google_sheets/<token>/addSheet?sheetName=tab2

- Request Parameters:

ObjectDescription
sheetName[Required] name of the tab you wants to add.

- Code Examples

const axios = require('axios');
    
axios({
    method: 'post',
    url: 'https://v1.nocodeapi.com/<username>/google_sheets/<token>/addSheet', 
    params: {sheetName: 'tab2'},
}).then(function (response) {
        // handle success
        console.log(response);
}).catch(function (error) {
        // handle error
        console.log(error);
})