Pushing data from the photon into google sheets

It’s been working all day now with multiple data entries.

My issue was two fold, and the first clue was actually in the error message returned. If you look further up in this thread you’ll see in the error message that there was an invalid argument stemming from “line 35” in the script. This is the part of the script where it gets the spreadsheet name to append, this is different from the sheet name in the spreadsheet. If you don’t save the script and select setup and run (this runs the setup function at the very end of the script) before you deploy the script, this sheet name is not saved and the script doesn’t know where to put the data. This is very nicely explained here;

https://steven.codes/blog/google-sheets-db-tutorial/

Secondly save your altered/updated scripts as new versions and deploy the correct version. :roll_eyes:

Sending multiple values was just a matter of naming an extra column and sending a second value like this

Particle.publish("Sunlight_Data_JS", "{\"my-name\":\"" + tempMessage + "\",\"my-count\":\"" + Ocelot.sampleCount +"\"}", 60, PRIVATE);

The trick is to keep track of all the quotes. Granted, I just brute forced it to make it work but am reading the webhook portion of the docs to change this to what I actually need for my application, I don’t need the dynamic custom fields. I should just be able to compile the JSON string with one of the printf variants and send it off.

I tried the webhook to Google Sheets a couple of years ago but I was much greener then and found the whole thing way too daunting. It’s amazing when you look back and discover what you’ve learned with the help of the people on this forum and the excellent documentation and eco-system that Particle has created. I’m a fan and I’m sure there are many more.

I am eagerly awaiting a wonderful box full of the new “meshy” things once they are ready to ship :smile:

Thanks,
Joerg

2 Likes