Can't post to Google Macro

Hi All,

So I'm trying to sent a GET to a Google sheet using this code:

  if (client.connectSSL(WEBSITE, 443))
    String URL = (String) "GET " + "/macros/s/AKfycbzS6lHOD599uMOBJamBLbxypxSuYgnwveNrRB4ldpwovt4qRlAoBP2HpsHD2wQaR7SY/exec?"	
     + "temp=" + (String) temperature
     + "&humid=" + (String) humidity
     + "&illum=" + (String) illuminance
     + "&moist=" + (String) moisture
     + "&lights=" + (String) lightsS
     + "&fan=" + (String) fanS
     + "&flag=" + (String) flagS;

    client.println(" HTTP/1.1"); 
    client.print("Host: ");
    client.println("User-Agent: MKR1000/1.0");
    Serial.println("\nData Sent"); 
  } else {
    Serial.println("Error connecting to website.");


It appears to work ok, but no data is getting through. I follow it with:

    String line = client.readStringUntil('\r');

but no data is returned. When I copy the code and paste it into Chrome, I get an OK returned and the data is fed from the script into the spreadsheet.

Any thoughts much appreciated!

Are there any spaces in URL? Please post the exact result of Serial.println(URL); (copy/paste!) .

Attempting to connect to SSID: LoungeDog
Connected to wifi
SSID: LoungeDog
IP Address:
signal strength (RSSI):-61 dBm
M: 0.00
Temperature = 18.96 °C
Humidity    = 58.49 %
Pressure    = 101.74 kPa
Illuminance = 16.13 lx
UVA         = 0.00
UVB         = 0.00
UV Index    = 0.00

Sending Data to Server...
GET /macros/s/AKfycbzS6lHOD599uMOBJamBLbxypxSuYgnwveNrRB4ldpwovt4qRlAoBP2HpsHD2wQaR7SY/exec?temp=18.96&humid=58.49&illum=16.13&moist=0.00&lights=1&fan=0&flag=1

Data Sent

(I tried copying directly with the correct web address as well - which works)

Update: I moved to an MKR1010 and am now getting some response - specifically a 302.

So now I need to figure out how to deal with that...

In case anyone still cares:

  1. I moved to a MKR1010
  2. I added the ArduinoHTTPClient library
  3. I had to redeploy the Google scripts as it was expecting people to log in (for no apparent reason!) which obviously the Arduino couldn't do...

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