How can I push my SD data to cloud like Google sheet?

Hi there,

Sorry, I'm a total beginner. I was wondering if anyone can help me with this project. I have just learned how to record data from my sensors into an SD card and this is the code.

/*
  SD card datalogger
 
 This example shows how to log data from three analog sensors 
 to an SD card using the SD library.
 	
 The circuit:
 * SD card attached to SPI bus as follows:
 ** UNO:  MOSI - pin 11, MISO - pin 12, CLK - pin 13, CS - pin 4 (CS pin can be changed)
  and pin #10 (SS) must be an output
 ** Mega:  MOSI - pin 51, MISO - pin 50, CLK - pin 52, CS - pin 4 (CS pin can be changed)
  and pin #52 (SS) must be an output
 ** Leonardo: Connect to hardware SPI via the ICSP header
 		Pin 4 used here for consistency with other Arduino examples
 
 created  24 Nov 2010
 modified 9 Apr 2012 by Tom Igoe
 
 This example code is in the public domain.
 	 
 */
#include <Wire.h>
#include <dht.h>
#include <SPI.h>
#include <SD.h>
#include <DS3231.h>


dht DHT;
DS3231  rtc(SDA, SCL); //  associate rtc with DS3231 library



String data, date, time;
#define Dht A2//Dht
int TemPin= A0;  //tmp
int LDR= A1; //Ldr
long check, light, temp, humid;




// On the Ethernet Shield, CS is pin 4. Note that even if it's not
// used as the CS pin, the hardware CS pin (10 on most Arduino boards,
// 53 on the Mega) must be left as an output or the SD library
// functions will not work.
const int chipSelect = 4;

File dataFile;

void setup()
{
  Wire.begin();
 // Open serial communications and wait for port to open:
  Serial.begin(9600);

  
  pinMode(LDR, INPUT); // LDR INPUT
  
  rtc.begin(); 
  rtc.setDOW(SUNDAY);  // set weekday
  rtc.setTime(10, 43, 40); // set the time to hh mm ss
  rtc.setDate(27, 2, 2022); // set the date to dd mm yyyy




  
  
   while (!Serial) {
    ; // wait for serial port to connect. Needed for Leonardo only
  }


  Serial.print("Initializing SD card...");
  // make sure that the default chip select pin is set to
  // output, even if you don't use it:
  pinMode(SS, OUTPUT);
  
  // see if the card is present and can be initialized:
  if (!SD.begin(chipSelect)) {
    Serial.println("Card failed, or not present");
    // don't do anything more:
    while (1) ;
  }
  Serial.println("card initialized.");
  
  // Open up the file we're going to log to!
  dataFile = SD.open("datalog.txt", FILE_WRITE);
  if (! dataFile) {
    Serial.println("error opening datalog.txt");
    // Wait forever since we cant write data
    while (1) ;
  }
}

void loop()
{
  // make a string for assembling the data to log:
  String dataString = "";
  String datatwo ="";



  // read three sensors and append to the string:
  for (int analogPin = 0; analogPin < 4; analogPin++) {
    
    
    
    DHT.read11(Dht);
    int Humid = (DHT.humidity);
    int Light = analogRead(LDR);

        //Tempreture Setup//
  int Tempreading = analogRead(TemPin);
              // Convert the reading into voltage:           
  float voltage = Tempreading * (5000 / 1024.0); //temp
  // Convert the voltage into the temperature in degree Celsius:
       //Tempreture Setup//

       
   int tempo = voltage / 10; //temp
   
    //  time = rtc.getTimeStr();   String(time)+ "," +  
       dataString =String(tempo)+"\xC2\xB0"+","+ String(Light)+","+String(Humid)+"%";
    if (analogPin < 4) {
      dataString += ","; 
    }
  }

  dataFile.println(dataString);

  // print to the serial port too:
  Serial.println(dataString);
  
  // The following line will 'save' the file to the SD card after every
  // line of data - this will use more power and slow down how much data
  // you can read but it's safer! 
  // If you want to speed up the system, remove the call to flush() and it
  // will save the file only every 512 bytes - every time a sector on the 
  // SD card is filled with data.
  dataFile.flush();
  
  // Take 1 measurement every 500 milliseconds
  delay(500);
}

Now I succeeded in saving records in my SD. However, my next step was to save the data stored with a comma between them to spreadsheet. The comma between reading meant to set each reading on its own cell.

I was trying out the Pushingbox website to record live sensors data in a spreadsheet and I followed few instructions on youtube, but I kept failing.

Now I was wondering if there is a way to just send all the data I was recording on my SD to a spreadsheet?

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.