Publish to google sheet

Hi all, I’m new to Particle Photon since a month or so. have some programming experience in vb and stuff… I have a particle photon connected to my garageport and with BLYNK i made an app to open and close my garageport. I have 2 reed sensors connected to monitor open and closed status of the door. I want to track when the port opens and closes in a google sheet. I managed to get this all working, but each time i publish something via ifttt to google sheet i get ± 13 entries in my sheet…

Can anyone suggest a better way to avoid this problem? Thanks a lot!!!
my code:

// This #include statement was automatically added by the Particle IDE.

#include <SparkCorePolledTimer.h>

// This #include statement was automatically added by the Particle IDE.
#include <blynk.h>

char auth = “--------”;

SparkCorePolledTimer updateTimer(1000); //Create a timer object and set it’s timeout in milliseconds

const int reedSwitchClosed = A0; // REED SWITCH CLOSED STATUS
const int reedSwitchOpen = A1; // REED SWITCH OPEN STATUS
const int relaySwitch = D0; // RELAY GARAGE PORT OUTPUT

int reedStatusClosed = 0; // CLOSED STATUS INITIALISATION
int reedStatusOpen = 1; // OPEN STATUS INITIALISATION
int openTimer = 0; // TIMER INITIALISATION

BLYNK_WRITE(V2) { // GPS TRIGGER - SENDS “1” TO V4 WHEN AWAY, - SENDS “2” to V4 WHEN COMING HOME
int state = param.asInt();
if (state) {
Blynk.virtualWrite(4, 1);
} else {
Blynk.virtualWrite(4, 2);
}
}

void setup()
{
Serial.begin(9600);
Blynk.begin(auth);
pinMode(relaySwitch, OUTPUT); // WRITE OUTPUT TO “A0” TO OPEN/CLOSE PORT
pinMode(reedSwitchClosed, INPUT_PULLDOWN); //CHECK PORT CLOSED STATUS
pinMode(reedSwitchOpen, INPUT_PULLDOWN); //CHECK PORT OPEN STATUS
updateTimer.SetCallback(garageStatus); // UPDATE TIMER
reedStatusClosed = digitalRead(reedSwitchClosed); //COPY PORT CLOSED STATUS TO CONST
reedStatusOpen = digitalRead(reedSwitchOpen); //COPY PORT OPEN STATUS TO CONST
}

void garageStatus(void)
{
reedStatusClosed = digitalRead(reedSwitchClosed); //COPY PORT CLOSED STATUS TO CONST
reedStatusOpen = digitalRead(reedSwitchOpen);
if (reedStatusClosed == LOW) { //CHECK IF PORT IS NOT CLOSED. (CLOSED SWITCH NOT IN POSITION)
Blynk.virtualWrite(0, 0); // WRITE “0” TO V0 IF PORT IS NOT CLOSED
Particle.publish(“POORT OPEN!”);
openTimer++;
}
//else if (reedStatusOpen == LOW) { //CHECK IF PORT IS NOT OPEN (OPEN SWITCH NOT IN POSITION)
//Blynk.virtualWrite(3,0); // WRITE “0” TO V3 IS PORT IS NOT FULLY OPENED
//openTimer++;
//}
//else if (reedStatusOpen == HIGH) { //CHECK IF PORT IS OPEN (OPEN SWITCH IN POSITION)
//Blynk.virtualWrite(3,1); // WRITE “1” TO V3 IS PORT IS FULLY OPENED
//openTimer++;
//}
//else if (reedStatusClosed == HIGH) { // CHECK IF PORT IS CLOSED (CLOSED SWITCH IN POSITION)
//Blynk.virtualWrite(0,1); // WRITE “1” TO V0 IF PORT IS FULLY CLOSED
//openTimer++;
//}
else {
Blynk.virtualWrite(0,1);
Particle.publish(“POORT GESLOTEN!”);
openTimer = 0; //STOP TIMER
}
if (reedStatusOpen == LOW) { //CHECK IF PORT IS NOT CLOSED. (CLOSED SWITCH NOT IN POSITION)
Blynk.virtualWrite(3, 0); // WRITE “0” TO V0 IF PORT IS NOT CLOSED
openTimer++;
}
//else if (reedStatusOpen == LOW) { //CHECK IF PORT IS NOT OPEN (OPEN SWITCH NOT IN POSITION)
//Blynk.virtualWrite(3,0); // WRITE “0” TO V3 IS PORT IS NOT FULLY OPENED
//openTimer++;
//}
//else if (reedStatusOpen == HIGH) { //CHECK IF PORT IS OPEN (OPEN SWITCH IN POSITION)
//Blynk.virtualWrite(3,1); // WRITE “1” TO V3 IS PORT IS FULLY OPENED
//openTimer++;
//}
//else if (reedStatusClosed == HIGH) { // CHECK IF PORT IS CLOSED (CLOSED SWITCH IN POSITION)
//Blynk.virtualWrite(0,1); // WRITE “1” TO V0 IF PORT IS FULLY CLOSED
//openTimer++;
//}
else {
Blynk.virtualWrite(3,1);
openTimer = 0; //STOP TIMER
}
}

void loop()
{
Blynk.run();
updateTimer.Update();

}

I did with an Arduino based on the following tutorial. Maybee this can help you.

I have tried it with Airtable instead of Google sheet but with no success.

Google sheet is fine but it is impossible to delete past history and you can not build a real database…

I will have a look, thank you!

deleting the history is not really necessary.

Also I used Blynk Webhook to send the data to the pushingbox. api. Much easier