May 21st, 2022 (edited)
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #include "TRIGGER_WIFI.h"               /*Includes ESP8266WiFi.h and WiFiClientSecure.h, just have these two libraries downloaded before*/
  2. #include "TRIGGER_GOOGLESHEETS.h"       /*Library file for Google Sheets, has to be used after Wi-Fi Client Secure declaration, here                 
  3.                                         /*everything is in Trigger_WIFI.h, so using it after Trigger_WIFI.h*/
  5. /**********Google Sheets Definations***********/
  6. char column_name_in_sheets[ ][10] = {"Name", "Surname", "Position"};  /*1. The Total no of column depends on how many value you have created in Script of Sheets;2. It has to be in order as per the rows decided in google sheets*/
  7. String Sheets_GAS_ID = "AKfycbxuKGsxqAWi1id_qErGAAPaZ5XdphEwUkA3vu0Yjinb-l8KzBbNq2JUkyNsM1MZAN_LcQ";  /*This is the Sheets GAS ID, you need to look for your sheets id*/
  8. int No_of_Parameters = 3; /*Here No_of_Parameters decides how many parameters you want to send it to Google Sheets at once, change it according to your needs*/
  9. /*********************************************/
  11. void setup()
  12. {
  13.   Serial.begin(9600);
  15.   WIFI_Connect("Guest", "anzora112#@");                                   /*Provide you Wi-Fi SSID and password to connect to Wi-Fi*/
  16.   Google_Sheets_Init(column_name_in_sheets, Sheets_GAS_ID, No_of_Parameters ); /*Sets the column name for Google Sheets, the GAS ID, and the No of Parameter we want to send*/
  17. }
  19. void loop(){
  20.   float a = 1, b = 2, c = 3;                            /*Demo values that has to be sent to google sheets, you can use sensor values*/
  21.   Data_to_Sheets(No_of_Parameters,  a,  b, c);          /*1. This function accepts multiple float parameter, here No_of_Parameters decides how many parameters you want to send to Google Sheets; 2. The values sent should be in order as per the column in Google Sheets*/
  22.   delay(1000);                                          /*10 Sec Delay, Here 10 second delay is just used so that we can see the data pushed to sheets one by one
  23.                                                         There is nothing like a minimum delay between two data push*/
  24. }
RAW Paste Data Copied