2

I am almost ashamed of asking this question since it must be super simple but I have looked everywhere on the web and I can't find it. The fact that Google recently changed the URL of its spreadsheets does not help.

Essentially, I am trying to read one value in a Google Spreadsheet and display it on my website. For instance, if I take this spreadsheet: https://docs.google.com/spreadsheets/d/1pzu6_-1rctgr_Zzr73Q1ZhJJrE0Ar8OH-uCaK50_V4w/edit#gid=0. How do I show in my html page some like < p > Current Temperature is < script .... > ... < /script >< /p > ?

I already know how to use google.visualization and I am showing historical trends on my website, but I simply want to include the current temperature on a separate page. I figure we can do this in two ways, first by directly querying with a specific URL or by using an API. But I have no idea how to do this.

Any help would be greatly appreciated.

Thank you!

2

2 Answers 2

1

I'm sorry to see that this post gets little attention. I ended up using google.visualization to read the last value of the spreadsheet. I think it's a little overkill, but it works.

Sign up to request clarification or add additional context in comments.

1 Comment

It's not an overkill... it's the right way to do it
0

I think your best bet would be to use Google Apps Script. You embed this script within the spreadsheet and it runs automatically, even if you don't have it open. (Documentation: https://developers.google.com/apps-script/reference/spreadsheet/spreadsheet). From what you've said above, I guess you want to do something like this:

  • When the Date Changes (You can set triggers in apps script)
  • Find the date in column A and grab the row number
  • Find the cell on that row in column B (Temp)
  • Get the value of that cell and pass it to your website.

Unfortunately I'm not sure how to solve your exact problem. Perhaps this will be a starting block or somebody else can take it from here. There is lots of documentation for apps script and there are plenty of Stack Overflow posts!

1 Comment

Thanks a lot luc122c. This does not seem ideal though. I mean there must be a way! Later on, I also plan to use Google Spreadsheet as a database where I would store a list of things, and read and post this list on my website using a JavaScript. I cannot do that with the Google Apps Script. I could do it with google.visualization: developers.google.com/chart/interactive/docs/spreadsheets but somehow, it does not seem to be the proper way to retrieve values. Alternatively, something simple like this: acrl.ala.org/techconnect/?p=4001 could work, but Google's URLs have changed.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.