Although there are so many cloud IoT platforms (ThingSpeak, thinger.io, TESPA.io, Xively, … ) available in the market, each offering APIs and tools to allow the Arduino and ESP8266 users to directly upload their sensor readings online for real-time visualization and global access, Google Drive is still my favorite choice for posting sensor data online as it is more approachable. If you are a regular user of Google Drive, you would find this tutorial from Anir very useful too. It describes a method of connecting the ESP8266 device directly to a Google sheet for storing the sensor data without using any third party service, like pushingbox that most other Arduino users have used for fulfilling Google’s http requirements and handling the URL redirection. This tutorial explains how you can make the task much simpler by using a recently published HTTPSRedirect Arduino library by Sujay Phadke that allows the ESP8266 to self-handle the redirect and https GET requests. The tutorial uses a NodeMCU board and a soil moisture sensor as input for demonstration. The sensor data are directly posted to a spreadsheet on Google Drive.
The way it works is you need to setup a Google Apps Script to access a spreadsheet in your Google Drive. The script have access to the spreadsheet via its document sharing key, which is unique and can be found on the URL of the sheet. In order to remotely run the Google Script without exposing your Google credentials, you need to publish it as a Web App URL. The ESP8266 can then send data to the spreadsheet using the same Web App URL with actual sensor data appended to it. Because Google requires you to send any GET request over an Web App URL using https (more secured than http), and then redirect your request to another URL location, the HTTPSRedirect Arduino library by Sujay Phadke is the key to handle this smoothly. Otherwise, you would need to use a third party online service to accomplish the same. The tutorial also describes how to configure the Google spreadsheet for receiving the soil moisture data in correct cells and uses some built-in chart features to display the time series in real time.
For more info, visit the article page.
hello, can you send the code for google script and arduino please.
Check for full article and code on Raj’s page: http://embedded-lab.com/blog/post-data-google-sheets-using-esp8266/