Example: Logging and graphing data from your Spark Core using Google

This exactly what I need! But I’m having some trouble getting this going. (Could be that this is first time I’ve ever done anything like this). IWhen you say “I used JSON to format the data from my :spark: Core, so that it was already in a format that’s easily parse-able by the Google Apps Script.”, does that mean there is more in the sketch that what is shown here to get the data into a readable format? I copied and pasted the function collectdata into my google drive (replacing my device id and access code and got the following message:
Request failed for https://api.spark.io/v1/devices/53ff6b066678505517491467/result?access_token=1bcef321b85b25c974c125a3beeeba89fc02bfcf returned code 404. Truncated server response: { “ok”: false, “error”: “Variable not found” } (use muteHttpExceptions option to examine full response) (line 4, file “Code”)

Here is my sketch:

//Variables
char resultstr[64];

const int RESSET = D7;
const int LID1 = D6;
const int LID2 = D5;
const int LID3 = D4;
int LID1count = 0;
int LID2count = 0;
int LID3count = 0;
int resetstate;
int LID1state;
int LID2state;
int LID3state;



void setup() //routine runs only once upon reset, this is your setup
{//Initialize pins as inputs
    pinMode(RESSET, INPUT_PULLUP);
    pinMode(LID1, INPUT_PULLUP);
    pinMode(LID2, INPUT_PULLUP);
    pinMode(LID3, INPUT_PULLUP);
    Spark.variable("Results",&resultstr, STRING);
   
}

void loop() //put your main code here, to run repeatedly
{
    //read the state of the pins
resetstate = digitalRead(RESSET);
LID1state = digitalRead(LID1);
LID2state = digitalRead(LID2);
LID3state = digitalRead(LID3);

if (resetstate == LOW)
{
    LID1count = 0;
    LID2count = 0;
    LID3count = 0;
   
    delay(1000); // wait for a second
}
else

{ //check to see if reset button is being pushed
    if(LID1state == LOW)
    { //checks to see if LID1 pushbutton is being held low
        delay(5000); //waits 5 seconds to see if lid stays open
        if(LID1state == LOW)
        {
           LID1count++; 
           
        }    
        
    }
    if(LID2state == LOW)
    { //checks to see if LID1 pushbutton is being held low
        delay(5000); //waits 5 seconds to see if lid stays open
        if(LID2state == LOW)
        {
           LID2count++;
          
        }    
        
    }
    if(LID3state == LOW)
    { //checks to see if LID1 pushbutton is being held low
        delay(5000); //waits 5 seconds to see if lid stays open
        if(LID3state == LOW)
        {
           LID3count++; 
           
        }    
        
    }
    
}
sprintf(resultstr, "{\"LID1count\":%d,\"LID2count\":%d, \"LID3count\":%d}", LID1count, LID2count, LID3count); 
delay(1000);//wait a second
}

I’ve edited your post to properly format the code. Please check out this post, so you know how to do this yourself in the future. Thanks in advance! ~Jordy