Good evening everyone! I'm working on a project with an ESP8266. I want to exchange information between ESP8266 and google spreadsheets. I can read the spreadsheet information with this very simple and efficient code:
if (client.connect("sheets.googleapis.com", 443) == true) { enviar = "GET /v4/spreadsheets/" + id_planilha + "/values/" + aba + "!" + celulas + "?key=" + chave_de_API + " HTTP/1.1"; client.println(enviar); client.println("Host: sheets.googleapis.com"); client.println(dados); client.println(); client.stop();
Now I also need to write in the spreadsheet, using the same method, choosing the exact cell in which it should be written. I tried doing this with this code:
if (client.connect("sheets.googleapis.com", 443) == true) { enviar = "GET /v4/spreadsheets/" + id_planilha + "/values/" + aba + "!" + celulas + "?valueInputOption=USER_ENTERED?key=" + chave_de_API + " HTTP/1.1"; dados = "{\"majorDimension\": \"ROWS\",\r\n"; dados += "\"values\": [\r\n"; dados += "[\r\n"; dados += "60"; dados += "\r\n"; dados += "]\r\n"; dados += "]\r\n"; dados += "}\r\n"; client.println(enviar); client.println("Host: sheets.googleapis.com"); client.println(dados); client.println(); client.stop();
But unfortunately it did not work. I think I'm putting the request in the wrong way. That's why I'm asking for an invalid argument. I have the API key and I set up the spreadsheet to share with whoever has the link, with permission to edit. How to solve this problem? How to edit the worksheet using the spreadsheet API? Thanks in advance for any help!