Sending data to google docs

I would love to see an example of sending data to a Google Spreadsheet.

1 Like

Hey @whampus, can you tell us more about your use case? What are you working on? I’m not familiar with the Google Spreadsheet API, and whether it is possible to send data into a spreadsheet from an external service, although it seems like a fun and Google-y thing to do.

I would like my students to make their own wireless sensors for science class/projects. Data would automatically be sent to a pre-made google spreadsheet. It would even update a premade graph with the new data as it’s collected!

It would be a lot of fun for long term projects like measuring plant growth since students could check the progress via the spreadsheet form home over the weekend.

With Google API 3.0 there’s the ability to modify multiple cells with a batch request. I have not tried this out though.

3 Likes

Very cool! If you do start experimenting with Google API 3.0, please share your findings here; this sounds like a great way to collect data for analysis.

the easiest way to do this is to use google spreadsheet and create an entry form. once you have a form linked to the spreadsheet, you can use a traditional POST method. this is the way ive seen it done. its scrappy, but it works.
here is a link to someone who’s done it this way for an arduino with a wify shield (how happy are you thats no longer needed???)

1 Like

The code listing on that open-electronics page uses Ethernet.h for the Arduino Ethernet Shield. Will the spark core be able to use this library directly or will a port be necessary? I, too, am looking to do an HTTP POST directly from the device to google spreadsheets.

@ke5in it will need to be ported, and they are working on that currently. It should be ready for release by or before the time they are shipping Cores for the kickstarter fulfillment :wink:

@ke5in it will require a small port; we are doing something very similar to Ethernet but it will be called TCP.h instead of Ethernet.h (because of course you’re not using Ethernet!) However you will likely find it easier to do things like this through the Spark Cloud.

@zach ok, I’ll look for TCP.h when it’s out. Question: Would I be able to contact the Cloud from the device and have the Cloud POST to Google docs OR will I have to have a second computer poll the device through the Cloud and then have the computer do the POST once i get the data from the device via the Cloud?

I’m not terribly familiar with the Google Docs API but if all it needs is a POST request, then you should be able to register a callback and have it drop the data directly into Google Docs.

I believe you can do this with Google API v3.0, I am just worried about the security/oauth handling that would be necessary to access Google’s API. The only other way that I can think of without having to authenticate is by using a Google Form (as suggested by @avidan).

Does Google now require outh for all external communication to/from Google App Script Engine? Does Spark Core of an API already to handle common security tasks such as negotiating oauth tokens?

Any news on this?

I found a way to post stuff to a google spreadsheet here…
(…see first answer)

2 Likes

I would probably build a simple Node.js app to handle the auth with Google and polling the data from the sensors every 10 seconds or so. There is a couple of node libraries to handle the google spreads sheet such as https://npmjs.org/package/google-spreadsheet and there there is also Spark node libraries such as https://npmjs.org/package/spark-io

This would give you a good start and fairly easy deploy of more sensors into your network that all gets pulled into the Google spreadsheet.

aha… your right… I’ve been thinking of this the wrong way!
Instead of sending data from my spark, It’s easier to pull data…
Now I’ve made a small script on my google spreadsheet that pulls data from the spark using Time-Driven Triggers.

This is the first draft of the script… does the job, but I will improve it… :smile:

http://pastebin.com/CeUfxw60

Thanx for the help!

Hi,

nice one! I would like to collect temperature data on a google doc.

the script you posted (http://pastebin.com/CeUfxw60) how I can use it?

can you give an example?

thank you

You can launch the Script Editor from a Spreadsheet by choosing Tools > Script Editor.
when your script is ready, set a Time-Driven Trigger
From the Script Editor, choose Resources > Current project’s triggers.

see here
https://developers.google.com/apps-script/guides/sheets
and here
https://developers.google.com/apps-script/execution_time_triggers

hope you get it working… :smile: :thumbsup:

1 Like

Look here : https://community.spark.io/t/example-logging-and-graphing-data-from-your-spark-core-using-google/2929/2

it is work for me.

1 Like

Hi sir
I am getting sensor data from Arduino to node.js but i dont know how to send how to send these data to google docs. could you help it me…

Hi, you could start here: