How to take data from a google sheets API - javascript

I'm a highschooler working on a website. We have a google sheets with log in information. Its connected to javascript. I was wondering how do I redirect this data to be used in html (which has the bulk of the project).
I've really been at a loss

Related

Using google spreadsheet as a database for a tumblr theme?

I am currently using tumblr as a website for my club. On tumblr there is a page, where every club member has a 'profile card' with their name, description and profile image.
I wondered if there is any way to create a google spreadsheet with the members' information and use the spreadsheet as a database, which can be accessed in the tumblr theme's HTML code.
I have been reading about Google App Scripts and JavaScript, but I just can't seem to connect those with tumblr and my idea (and actually I am not sure if tumblr is supporting it either).
So basically what I want to do in the tumblr HTML code is:
-Access a google spreadsheet
-Parse the data into a two-dimensional array
-Use array values to create new div elements
The reason, why I want to do this is because I don't want the members to login in tumblr and go through the hassle to mess with the code. They should be able to easily put their information into a spreadsheet, which is connected to the tumblr website, and every time the spreadsheet is changed, the website just needs to be refreshed and it is again up to date.
I will be thankful for any kind of help =)
I have done a similar task using Google Sheets as a database for small sets of data to be edited by non technical maintainers, and it can work quite well.
You have mentioned that you can add custom Javascript, so it should be possible in your case. Here are the general steps you would take:
Setup your sheet to be accessed via API
Pull data via the Javascript fetch API
Process and display the data on your tumblr site
This actually works quite well and allows for easy updating of what is essentially static data.
For more info on how you can open up your sheet and access it with the API check out this article or ones like it available via Google.

How can I use Google Sheets API as database?

I am trying to write a web application in javascript that reads and writes to a single Google sheet as a database. It basically reads from the sheet, make sure everything is in order, then writes to the sheet. All users will be using the same sheet, however I don't want the sheet to be able to be accessed outside the web application except for trusted users. I have a problem with writing to the sheet, as apparently it has to do O_Auth2 which has such poor documentation(where the hell do I put the key in the PUT request????) and all users would have to sign into my account. I don't think this would really work. Any ideas????
Thanks so much.

How to allow users to access my Google API application without authenticating for it?

I've developed a small webapp, that pulls raw data from a Google Spreadsheet and builds it on a html, so my website users can see, filter and navigate through the data.
For that, I'm using Google Sheets API v4, but even going to an HTML, users are asked to "AUTHORIZE" access using their Google Accounts, before seeing the table/data.
Is there a way to display this table/data on the HTML, without requesting users to authorize through OAuth?
If you're dealing with accessing data and performing Google API calls, authorization is Google's way to protect and secure the user's data.
If you want to display the data without needing to undergo authorization, publish it to the web:
File -> Publish to the web. An embed code which contains a public url will be provided for you.
Here's a sample of my public data:
https://docs.google.com/spreadsheets/d/1mvFPT2Xx8bNEMUdPC9TDOexzNqVS399bxQATV3JVOyg/pubhtml?widget=true&amp

Is there a way to display data from a private google spreadsheet as a chart on a website?

I am doing a project for my school. I have logged in the number of visitors who come to the school using a car, a bike, a bicycle or some other form of transport on a google spreadsheet. I want to be able to display all the data in the form of charts on my school website in order to keep track of the CO2 emissions caused by people to come to school daily.
I read about the google spreadsheet api but can't understand how to get data from the spreadsheet without making it public.
Any help would be greatly appreciated.
Thanks.
no need to code this in apps script. Google sheets natively supports publishing charts.
https://support.google.com/docs/answer/78052
Depending on how you published the chart, its a different process to update the chart as the data changes.
If you used "publish to the web", simply republish, or modify the URL to remove the range (with some caveats, see this help topic on ways to do it. Its an old post and the new sheets publish url may be different or allow open ranges (like A1:C). https://productforums.google.com/forum/?hl=en#!category-topic/docs/how-do-i/ZRpghByKHNM
If you publish the chart inside a doc or presentation, see http://googleappsupdates.blogspot.pe/2016/05/embed-charts-from-google-sheets-in.html which is a more streamlined way to update the chart, but requires an intermediate doc/slide.
Yes definitely, write code in Google app script to get required data from spreadsheet, deploy your script (anyone even anonymous option), change version of script each time when you are changing code and deploy again.
Get URL of deployed app script, do ajax call to that url from your javascript code (in your web application) and get required data and use it to show chart using any chart plugin from jquery.

How to embedded a Google Analytics widget that is restricted to a single URL?

I'm working on a sort of image hosting website where each uploaded image has its own page and unique URL. Within that page, I would like to display an analytics graph/widget which would display how many visitors visited the page in the past week or month.
I'm already using Google Analytics for the whole website so it would be nice if I could just pull out data for that specific URL out from Google Analytics and display it in a graph.
I noticed GA already has an embed API (https://developers.google.com/analytics/devguides/reporting/embed/v1/) but it doesn't seem to be possible to restrict the graph data to a single URL.
Any suggestions (including third party services or alternatives to GA) on how to achieve this quickly and securely would help greatly.
To answer my own question, it seems the only secure way to do this is to pull out the data server side using the Google Analytics API and build my own custom graph widgets (e.g. using Google Charts) on the client.

Categories