Use Google Sheet as a backend -_-

Tram Ho

Google Sheets is a very popular spreadsheet application that anyone with a Google account can use for free. It is very intuitive and even people with no prior experience of using sheets will find it quite easy to use.

You are just starting to learn web programming and want to build your own website but do not have the back-end skills like Node.Js , Ruby or Python , this is the article for you. Or if you want to create a simple blog-style website or porfolio, or if you want to quickly build a prototype / mockup for a new feature, this is also the article for you.

In this article, I will introduce to use Google Sheets as Database for your website.

Things you need to know: HTML, CSS, JavaScript, jQuery, Ajax basics.

How to do the following:

The method is quite simple, you just need to fetch data from sheets, there are quite a lot of options for this, you can use the Google Sheets API .

Step 1: Create your sheets page example . Then publish it first to get the JSON response. Click FilePublish

Then copy the Id starting after / d / to the end.

Step 2: Now take a look at this URL

Open Google Sheet, then copy the sheet code sheet number and the sheet number , for example:

Then the sheet code is 1M4a_1NT7sws0rUA5aZnE4ERZmO39ustwr0NQKL6vlzE and the sheet number is 1
Instead of above, now try this URL

You can get JSON from Sheets without using a third-party tool.

Step 2.1: You can use the tool to get a nice JSON response (which will filter out unnecessary things) like Tabletop.js

Integrate Google Sheets into your website
First, use a static website first. Then add this, we will use TableTop :

Then write the init function as follows:

Write the showInfo function:

That's it and now you just need to run the website to see the results.

Also you can use some other tools to interact with your sheets, I found a pretty good tool is BlockSpring You can query data, add new data to sheets with code.

Select data

Add new

Ok, I have finished talking about how to use Google Sheets as a backend, now whenever you need to build a fast, simple website, I hope this article will help you. ?

Reference: https://dev.to/sarthakganguly/google-sheets-as-your-web-backend-4a65

Share the news now

Source : Viblo