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 NoCodeAPI. If not then first make an account there and activate Google Sheet API from Marketplace. Follow this article for a quick setup. Setup Google Sheet API
When you will finish your Google Sheet API then you will see this card with your sheet secure API endpoint.
Use API Endpoints:
With Google sheet API you can do:
- Get rows (GET Request)
- Get single row (GET Request)
- Add new row (POST Request)
- Update a row (PUT Request)
- Delete a row (DELETE Request)
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.
#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
.
curl https://v1.nocodeapi.com/betauser/google_sheets/mLjulmxwQuctZXNl?tabId=<tabId>
Here is the result that will be consoled as 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
.
curl https://v1.nocodeapi.com/betauser/google_sheets/mLjulmxwQuctZXNl?tabId=<tabId>&row_id=<row_id>
Here is a result you will get.
{
"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
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:
{ "message": "Successfully Inserted" }
#Update row
To update a row in your google sheet you have made a PUT
call with object data into body
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:
{ "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.
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:
{ "message": "Deleted successfully" }
We did it.
Originally published at nocodeapi.com
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:
Top comments (1)
Great one! i was looking for articles that will teach me how to build an API to turn google sheets into API. then i found an API tool of Sheet Best, with which i can easily connect my google sheets with API and it's seem really simple and easy!i what do you think ? will it be best for me?