# Uploading Electron Data to Google Drive

**URL:** <https://community.particle.io/t/uploading-electron-data-to-google-drive/24532>\
**Category:** Getting Started\
**Created:** [July 20, 2016, 8:15pm UTC](https://community.particle.io/t/uploading-electron-data-to-google-drive/24532 "2016-07-20T20:15:56Z")\
**Posts on this page:** 20\
**Page:** 1

<div class="post-metadata">

**Author:** ![darthreya](https://avatars.discourse-cdn.com/v4/letter/d/7ab992/32.png) [@darthreya](https://community.particle.io/u/darthreya)\
**Post date:** [July 20, 2016, 8:15pm UTC](https://community.particle.io/t/uploading-electron-data-to-google-drive/24532/1 "2016-07-20T20:15:56Z")

</div>

So I am entirely new to developing in Particle and was wondering if there was a way where I could take stored data on my electron and upload to google drive at regular intervals? I saw someone do it using an arduino by using google forms and was hoping to be able to achieve something similar with the Electron. I’ve linked the project that I’m trying to emulate below.

> **[Post to Google Docs With Arduino](http://www.instructables.com/id/Post-to-Google-Docs-with-Arduino/)**
>
> Lets get right into this. I was logging temperature of a room to an Excel sheet via Serial.print commands, then importing CSV files and yada yada. I couldn't get to...

Thanks in advance for the help!

---

<div class="post-metadata">

**Author:** ![ScruffR](https://sea2.discourse-cdn.com/flex026/user_avatar/community.particle.io/scruffr/32/6952_2.png) [@ScruffR](https://community.particle.io/u/ScruffR)\
**Post date:** [July 20, 2016, 8:20pm UTC](https://community.particle.io/t/uploading-electron-data-to-google-drive/24532/2 "2016-07-20T20:20:37Z")

</div>

When searching the forum for _google docs_ some threads turn up  
[https://community.particle.io/search?q=google%20docs](https://community.particle.io/search?q=google%20docs)

I guess there are some infos to get you started

---

<div class="post-metadata">

**Author:** ![darthreya](https://avatars.discourse-cdn.com/v4/letter/d/7ab992/32.png) [@darthreya](https://community.particle.io/u/darthreya)\
**Post date:** [July 20, 2016, 8:31pm UTC](https://community.particle.io/t/uploading-electron-data-to-google-drive/24532/3 "2016-07-20T20:31:03Z")

</div>

Oh my I just made the classic mistake of not checking first. My apologies! I typed in “Electron Google drive” and nothing seemed to show that was recent so I sort of just went for the lazy ask for guidance solution. I’ll look into searching around more and will come back with followup questions maybe. Thank you for your time and your answer!

---

<div class="post-metadata">

**Author:** ![gusgonnet](https://sea2.discourse-cdn.com/flex026/user_avatar/community.particle.io/gusgonnet/32/27491_2.png) [@gusgonnet](https://community.particle.io/u/gusgonnet)\
**Post date:** [July 26, 2016, 12:11pm UTC](https://community.particle.io/t/uploading-electron-data-to-google-drive/24532/4 "2016-07-26T12:11:20Z")

</div>

hey, some time ago I did a project with a photon that was storing data in a google docs, so maybe it can help you at this time?  
I described all I did here:

> **[Storing data in Google](https://www.hackster.io/gusgonnet/storing-data-in-google-714dde)**
>
> Store any data you want in Google Sheets By Gustavo Gonnet.

and the project I used it is here:

> **[Pool temperature monitor](https://www.hackster.io/gusgonnet/pool-temperature-monitor-5331f2)**
>
> Know the temperature of your pool anywhere, anytime By Gustavo Gonnet.

Gustavo.

---

<div class="post-metadata">

**Author:** ![darthreya](https://avatars.discourse-cdn.com/v4/letter/d/7ab992/32.png) [@darthreya](https://community.particle.io/u/darthreya)\
**Post date:** [July 27, 2016, 6:29pm UTC](https://community.particle.io/t/uploading-electron-data-to-google-drive/24532/5 "2016-07-27T18:29:07Z")

</div>

Hi Gustavo!

Thank you for the links! They seem exactly like the thing I’m trying to achieve. My concern is(and I understand that you might not have the answer) how I can get the electron to communicate with the google sheets script. I don’t want to be constantly collecting data but more during certain periods of time. Would I be able to start the script using the electron? For example in your pool data example: lets say that I want to only collect data when the sun is out and I have a photosensor to do that. I don’t want to be sitting around pressing collect on the script each time I see the sun but rather I want to automate the system. (I will look into it too, but I was just wondering if you had any thoughts on that matter)

Once again thank you for the links! They really did help!

–Darthreya

---

<div class="post-metadata">

**Author:** ![gusgonnet](https://sea2.discourse-cdn.com/flex026/user_avatar/community.particle.io/gusgonnet/32/27491_2.png) [@gusgonnet](https://community.particle.io/u/gusgonnet)\
**Post date:** [July 28, 2016, 11:21am UTC](https://community.particle.io/t/uploading-electron-data-to-google-drive/24532/6 "2016-07-28T11:21:40Z")

</div>

Hum, I see.  
In you case, I guess the electron (or a photon, or a core) will have to initiate the conversation to the google sheet, in the form of publishing an event. Once this event is published, I imagine a particle cloud webhook matching that event getting triggered. This webhook will have to be the one calling the google script it some way (that I really hope google provides).  
Since my hardware is on all the time, I have not had the need for such a mechanism, but if I figure something out (or hopefully you do) then I’ll post back here.  
Just did a search on hitting a google api, and this is one of the results:

> <https://stackoverflow.com/questions/12169281/how-to-call-a-google-api>

Looks promising!  
Gustavo.

---

<div class="post-metadata">

**Author:** ![gusgonnet](https://sea2.discourse-cdn.com/flex026/user_avatar/community.particle.io/gusgonnet/32/27491_2.png) [@gusgonnet](https://community.particle.io/u/gusgonnet)\
**Post date:** [August 3, 2016, 2:14am UTC](https://community.particle.io/t/uploading-electron-data-to-google-drive/24532/7 "2016-08-03T02:14:27Z")

</div>

@darthreya: alternatively, you can use a service like ubidots (or others) instead of google docs and have exactly what you want:  
[http://ubidots.com](http://ubidots.com)  
Gustavo.

---

<div class="post-metadata">

**Author:** ![gusgonnet](https://sea2.discourse-cdn.com/flex026/user_avatar/community.particle.io/gusgonnet/32/27491_2.png) [@gusgonnet](https://community.particle.io/u/gusgonnet)\
**Post date:** [August 5, 2016, 10:59pm UTC](https://community.particle.io/t/uploading-electron-data-to-google-drive/24532/8 "2016-08-05T22:59:33Z")

</div>

hey,  
I found the way to save data pushed from your particle into a google sheet.

I followed these instructions for the google sheet configuration:

> **[Business web application development with Ruby on Rails and much more | Rails...](https://railsrescue.com/blog/2015-05-28-step-by-step-setup-to-send-form-data-to-google-sheets/)**
>
> We build, enhance, and maintain business websites built with Ruby on Rails

Then created a particle webhook with:  
event name: googleDocs  
full url: what you get from google docs (example: [https://script.google.com/macros/s/1236278936489127634-2876348/exec](https://script.google.com/macros/s/1236278936489127634-2876348/exec))  
POST  
form: key=name value={{my-name}}  
headers: "Content-Type": "application/x-www-form-urlencoded; charset=UTF-8"  
include defaults: no

then in your firmware:  
Particle.publish("googleDocs", "{"my-name":"aloha"}", 60);

I learned few tricks on the webhook custom features here:

> [@More events in one Webhook (SOLVED)](https://community.particle.io/t/more-events-in-one-webhook-solved/16516/10):
>
> Ok, I was able to get a Photon posting to a dynamic webhook URL (this particular example is for posting to a Slack channel): Code: Spark.publish("log\_info", "{\"my-log\": \"Yo!\", \"my-url\":\"a/b/c\"}", 60); Webhook definition: { "eventName": "log\_", "url": "https://hooks.slack.com/services/{{my-url}}", "requestType": "POST", "json": { "username": "{{SPARK\_CORE\_ID}}", "text": "{{my-log}}" } } Hope that works for you, too!

Screenshot of my particles reporting events to my google sheet:

 ![](https://us1.discourse-cdn.com/flex026/uploads/particle/original/2X/6/6306974c6ab28c1fd1f497606d0ee83c8e9cacec.png)

It worked for me. Hope it helps,  
Gustavo.  
PS: I have a few "undefined" fields but hey, that will be fixed next time

---

<div class="post-metadata">

**Author:** ![RWB](https://sea2.discourse-cdn.com/flex026/user_avatar/community.particle.io/rwb/32/22599_2.png) [@RWB](https://community.particle.io/u/RWB)\
**Post date:** [August 8, 2016, 1:33am UTC](https://community.particle.io/t/uploading-electron-data-to-google-drive/24532/9 "2016-08-08T01:33:18Z")

</div>

I have done Google Doc to store data and then I tried Ubidots and it was so much easier and better at displaying your data that never looked back at the Google Docs or spreadsheet for data storage.

Ubidots is free so might as well give it a try, I’m sure you will be happy with it.

---

<div class="post-metadata">

**Author:** ![gusgonnet](https://sea2.discourse-cdn.com/flex026/user_avatar/community.particle.io/gusgonnet/32/27491_2.png) [@gusgonnet](https://community.particle.io/u/gusgonnet)\
**Post date:** [August 9, 2016, 1:17pm UTC](https://community.particle.io/t/uploading-electron-data-to-google-drive/24532/10 "2016-08-09T13:17:46Z")

</div>

I have now documented all this in this hackster article:

> **[Pushing Data to Google Docs](https://www.hackster.io/gusgonnet/pushing-data-to-google-docs-02f9c4)**
>
> Make your hardware push data to a Google spreadsheet. By Gustavo Gonnet.

  
Gustavo.

---

<div class="post-metadata">

**Author:** ![darthreya](https://avatars.discourse-cdn.com/v4/letter/d/7ab992/32.png) [@darthreya](https://community.particle.io/u/darthreya)\
**Post date:** [August 11, 2016, 12:47pm UTC](https://community.particle.io/t/uploading-electron-data-to-google-drive/24532/11 "2016-08-11T12:47:15Z")

</div>

Thanks for all the help! I was travelling so I didn’t get much time to work on the device more. I ended up working out the scheduling functions instead in the meantime. Ubidots seems like a great resource and I will most definitely check it out. Also thanks again @gusgonnet for the super helpful guide! I’ll see if I can make headway on my project and let you all know how it goes and maybe make a post about it.

---

<div class="post-metadata">

**Author:** ![pshah](https://avatars.discourse-cdn.com/v4/letter/p/a698b9/32.png) [@pshah](https://community.particle.io/u/pshah)\
**Post date:** [March 30, 2017, 5:25pm UTC](https://community.particle.io/t/uploading-electron-data-to-google-drive/24532/12 "2017-03-30T17:25:30Z")

</div>

Hi Gustavo,

I am trying to do same and followed every single steps carefully as you mentioned. I using electron to perform this.

However, hook sent is always undefined.

I tried FORMS and JSON formats but none works.

In the Form I feel  
key = name  
value = {{my-name}}

in JSON, I write  
{  
“key”: “name”,  
“value”: “{{my-name}}”  
}

but none of this option works.

I created google form to push the data to spread sheet. It works fine. So it appears that something I am messing it up either at the webhook or in the firmware.

In the firmware, I wrote following:  
Particle.publish(“googleDocs”, “{“my-name”:“aloha”}”, 60);

So when I monitor logs, it says  
googledocs {“my-name”:“aloha”}  
data "{“my-name”:“aloha”}"  
hook-sent/googleDocs undefined

Not sure where I am making mistake

---

<div class="post-metadata">

**Author:** ![pshah](https://avatars.discourse-cdn.com/v4/letter/p/a698b9/32.png) [@pshah](https://community.particle.io/u/pshah)\
**Post date:** [March 30, 2017, 6:10pm UTC](https://community.particle.io/t/uploading-electron-data-to-google-drive/24532/13 "2017-03-30T18:10:21Z")

</div>

I tried to see the response on requestBin

I see following there  
{“event”:“googleDocs”,“data”:"{“my-name”:“aloha”}",“published\_at”:“2017-03-30T18:07:03.170Z”,“coreid”:“XXXXXXXXXXXXXX”,“value”:“aloha”,“key”:“name”}

So it looks like the data is parsed and displayed here but something might be going wrong for googledocs

---

<div class="post-metadata">

**Author:** ![gusgonnet](https://sea2.discourse-cdn.com/flex026/user_avatar/community.particle.io/gusgonnet/32/27491_2.png) [@gusgonnet](https://community.particle.io/u/gusgonnet)\
**Post date:** [April 5, 2017, 6:25pm UTC](https://community.particle.io/t/uploading-electron-data-to-google-drive/24532/14 "2017-04-05T18:25:54Z")

</div>

Hi,  
this is how a webhook looks like in my console:

 ![](https://us1.discourse-cdn.com/flex026/uploads/particle/original/2X/d/d848baed9ba254bba59fa15b41662af5d40503fd.png)

if nothing is reaching the spreadsheet, I recommend you publish it again as described in section “Setup the Google Docs Side”, specially this step from the linked site:  
// 3. Publish \> Deploy as web app  
// - enter Project Version name and click ‘Save New Version’  
// - set security level and enable service (most likely execute as ‘me’ and access 'anyone, even anonymously)

hope it helps  
Gustavo.

---

<div class="post-metadata">

**Author:** ![pshah](https://avatars.discourse-cdn.com/v4/letter/p/a698b9/32.png) [@pshah](https://community.particle.io/u/pshah)\
**Post date:** [April 11, 2017, 2:44pm UTC](https://community.particle.io/t/uploading-electron-data-to-google-drive/24532/15 "2017-04-11T14:44:23Z")

</div>

Hi Gustavo,

Many thanks. It worked. I was making mistake in Webhook.

I was using two rows:  
“key” = “name”  
“value” = “{{my-name}}”

when I changed it to one row  
"name" = “{{my-name}}”

it worked. I now understand how the form data works.

Thanks again.

---

<div class="post-metadata">

**Author:** ![gusgonnet](https://sea2.discourse-cdn.com/flex026/user_avatar/community.particle.io/gusgonnet/32/27491_2.png) [@gusgonnet](https://community.particle.io/u/gusgonnet)\
**Post date:** [April 11, 2017, 5:36pm UTC](https://community.particle.io/t/uploading-electron-data-to-google-drive/24532/16 "2017-04-11T17:36:38Z")

</div>

I’m happy to hear that you got it working!  
enjoy,  
Gustavo.

---

<div class="post-metadata">

**Author:** ![subhendu](https://avatars.discourse-cdn.com/v4/letter/s/5e9695/32.png) [@subhendu](https://community.particle.io/u/subhendu)\
**Post date:** [April 26, 2017, 6:05pm UTC](https://community.particle.io/t/uploading-electron-data-to-google-drive/24532/17 "2017-04-26T18:05:47Z")

</div>

Hey there,  
I know, it might be a little late to reply. But in case if anyone looking for a working example “how to use goggle spreadsheet using electron” can use [https://github.com/subhendukundu/Electron-GoogleSheet](https://github.com/subhendukundu/Electron-GoogleSheet)  
Hope this will help.  
Thanks

---

<div class="post-metadata">

**Author:** ![supscientist](https://sea2.discourse-cdn.com/flex026/user_avatar/community.particle.io/supscientist/32/16334_2.png) [@supscientist](https://community.particle.io/u/supscientist)\
**Post date:** [April 19, 2018, 7:07pm UTC](https://community.particle.io/t/uploading-electron-data-to-google-drive/24532/18 "2018-04-19T19:07:16Z")

</div>

@gusgonnet if you happen to still keep an eye on this thread, I first want to thank you for putting together such an incredible document! It’s exactly what I’ve been looking for and made it very straightforward to start the Google Sheets logging process.

I’m wondering if you can help me debug something: I have a field-deployed sensor with an Electron with firmware that I’d like not to change, if at all possible, which is sending data to the cloud with name `"CpHOx"` and a string of ASCII data in `"data"` like this:  
{  
“name”: “CpHOx”,  
“data”:“2018/04/19,00:00:25,18.650,0.08194,-0.82938,4.68200,8.10295,323.98099,14.55660,33.59880,4.04,82.70”,  
“ttl”: 60,  
“published\_at”: “2018-04-19T00:12:42.319Z”,  
“coreid”: “xxxx”  
}

I have my form fields set as follows but am not seeing any actual data come into the Google Sheet (I _do_ see new, accurate timestamps in the Google sheet every time Particle.publish() is called but name, email, phone, and message are just filled with “undefined” in each new row. I also tried to use `{{my-name}}` next to `value` but that didn’t work either.

 ![image](https://us1.discourse-cdn.com/flex026/uploads/particle/original/3X/4/1/41a7da1a04d3b3008a96eb0ca515fb37b80e21c6.png)

Any chance you might be able to offer a suggestion to help me get data from that publish call to the Google Sheet? Thanks!

---

<div class="post-metadata">

**Author:** ![supscientist](https://sea2.discourse-cdn.com/flex026/user_avatar/community.particle.io/supscientist/32/16334_2.png) [@supscientist](https://community.particle.io/u/supscientist)\
**Post date:** [April 19, 2018, 10:34pm UTC](https://community.particle.io/t/uploading-electron-data-to-google-drive/24532/19 "2018-04-19T22:34:20Z")

</div>

Switched my form to just:

 ![image](https://us1.discourse-cdn.com/flex026/uploads/particle/original/3X/5/a/5a46589f9b04fb2a1411bf81d5ae0cefe2309b71.png)  
And now I'm getting something back from the Electron, but there's a hiccup on the sensor side so I can't yet verify if it's all working.

If you do take a look at this thread again, @gusgonnet, I'd be really curious why it appears that you have two entries in FORM FIELDS (_viz_ “key”: “name”, “value”: “{{my-name}}”) but that "key":"name" pair doesn't appear to be necessary (also seen in the following quote).

> [@pshah](#):
>
> I was using two rows:
> 
> “key” = “name”
> 
> “value” = “{{my-name}}”
> 
> when I changed it to one row
> 
> "name" = “{{my-name}}”

Anyway, thanks again for the great tutorial!

---

<div class="post-metadata">

**Author:** ![gusgonnet](https://sea2.discourse-cdn.com/flex026/user_avatar/community.particle.io/gusgonnet/32/27491_2.png) [@gusgonnet](https://community.particle.io/u/gusgonnet)\
**Post date:** [April 20, 2018, 2:06am UTC](https://community.particle.io/t/uploading-electron-data-to-google-drive/24532/20 "2018-04-20T02:06:58Z")

</div>

Hi Phil,

I'm happy that you found the write-up useful!

Now, I cannot figure out why I wrote in Hackster **form: key=name value={{my-name}}** when I have today in my webhook:

> {  
> "name": "{{my-name}}"  
> }

**EDIT:** Oh I remember now. I believe the particle web console representation of the form changed. I did not mean to add two lines, it's ONE line where the key is **name** and the value is **{{my-name}}** which in JSON looks like:  
"name": "{{my-name}}"

I hope you are able to get away with your data untouched in your CpHOx event:

> “data”:“2018/04/19,00:00:25,18.650,0.08194,-0.82938,4.68200,8.10295,323.98099,14.55660,33.59880,4.04,82.70”,

Not sure if the google sheets webapp will accept the commas in that string, but hey! nothing is lost if you try.  
Good luck and report back please,  
Gustavo.  
EDIT 2: Here's a screenshot of my webhook today:

 ![image](https://us1.discourse-cdn.com/flex026/uploads/particle/original/3X/6/f/6ff09842b8fd122e0d70840e04744e92cec1a705.png)  
EDIT 3: I have updated the Hackster write-up now with more details about this

[Next page](https://community.particle.io/t/uploading-electron-data-to-google-drive/24532.md?page=2)
