Creating a POST request to a Google Sheet (App Script) using Arduino Uno WiFi Rev2

Hello,

I am trying to make my Arduino Uno WiFi Rev2 create a POST request to Google Sheets (using Google Sheet's App Script extension). I managed to establish a connection between the Arduino and Google Sheets and post a request with no errors. However, the sheet does not receive anything.

const char *GScriptId = "SCRIPT_ID";

// Enter command (insert_row or append_row) and your Google Sheets sheet name (default is Sheet1):
String payload_base =  "{\"command\": \"insert_row\", \"sheet_name\": \"Sheet1\", \"values\": ";
String payload = "";

// Google Sheets setup (do not edit)
const char* host = "script.google.com";
String url = String("/macros/s/") + GScriptId + "/exec";

if (client.connect(host, 443)) {

    Serial.println("connected to server");

    // Make a HTTP request:
    // Create json object string to send to Google Sheets
    payload = payload_base + "\"" + value0 + "," + value1 + "," + value2 + "\"}";
    
    unsigned  int len = payload.length() + 1;
    
    client.println("POST "+ url+ " HTTP/1.1");
    client.println("Host: " + String(host));
    client.println("Accept: application/json");
    client.println("Content-Type: application/json");
    client.println("Content-Length: " + String(len));
    client.println(payload);
    client.println("Connection: close");
    client.println();
    
    Serial.println("Post request done");

  }

I tried the same POST request using external sources and it worked fine and the google sheet got updated so the request is correct. However, with Arduino Uno WiFi Rev2, google sheets is not receiving anything.

Your sketch is incomplete so it can't be compiled. If you care to share a version that shows the problem and that CAN compile I will look it over.