What is “Google spreadsheets as database”. nowadays every one using the website if they want a website then needs to buy the space for the website and for storing purpose need to buy the space so in both cases we need to buy the spaces from third parties like GoDaddy, Bluehost etc. So to avoid these type of problems you need to know some knowledge in “google apps script”.
Everyone has a Gmail account. Drive also free. Google drive has so many free applications like Docs, sheet, slides, forms, apps script, Jamboards, blog etc. By using these applications we can do amazing things without a database like My SQL, SQL Server, DB2 etc.
Here I will teach you how to use Google spreadsheets as a database for your web application. But I am not using web application. Instead of that, I am going to use google blog.
Pre-requirements
Step 1: Open Gmail account
Step 2: create a blog after login into your Gmail account and name it.
Step 3: go to google drive click on the new button and create a new google spreadsheet.
Step 4: Give the name for google spreadsheets
Step 5: Go to blog create a new blog account
Step 6: create a page insert_values.
Step 7: publish the blog test it you will surprise.
Now open Google
spreadsheets and name it as "insert values" and given
5 column names as shown below image
Time_stamp, Id, Name, State, City, Country.
Now click on tools click on script editor. In script editor
you can write the code in javascript
The name is as insert values
and the extension is “.gs” means google script it is nothing but javascript.
In the editor, you can write the script.
Next, go to google spreadsheets and copy the link and paste
in as shown below image.
It is a “SpreadsheetApp.openByUrl”. it means while running
the program it opens the URL works as per requirement.
Finally, publish the script for anyone and save the
script_url. It will consume it anywhere.
Click Deploy Ã
deploy as Web app Ã
select “who has access to the app as anyone”.
Save the script URL.
Select the Anyone as shown above image and Click on deploy
button.
After the click, it asks to need permission to click on it. Select your
Gmail account and go to advance click on insert value(unsafe). Finally, click on allow button copy the URL.
below is the script.
Now goto blog. Create a new blog and create a new page in the blog
Now go to notepad++ write javascript and paste the URL as
shown below.
And create the required fields in the body tag
Finally, copy all the
above script and paste in blogger page
publish it
Open in the browser then it looks like below image. these all values will insert into google spreadsheets after the button click
Click on insert button then the data goes and sits in
insert_values google spreadsheets as shown below image. After insert button, it
shows as successfully inserted.
Now go and check the google spreadsheets. All value you can find in
google spreadsheets.
the above article only for insert values into google spreadsheets. in next article, you can find the Update, delete and view the values from "google spreadsheets as database"
Post a Comment (0)