Sim7000 upload to google spreadsheet

Hi

I bought the LilyGO-T-SIM7000G and i am trying to send data to google spreadsheet with it see link:Google Spreadsheet or Google Sheets with ESP8266 Nodemcu for Data Logging

but the example shows only how to do it via wifi not via a sim card.

I Have tested the lilygo see link: LilyGO-T-SIM7000G/AllFunctions.ino at master · Xinyuan-LilyGO/LilyGO-T-SIM7000G · GitHub

works fine but I don't know how to get it work with the google spreadsheet?

Can you please help me?

Thanks

you could try this webclient example here

that uses TinyGSM lib to perform a GET request over cellular modem

note that you will have to uncomment the line

// #define TINY_GSM_MODEM_SIM7000

If all is well, you can gently edit it to suffice your need

Thanks for your feed back
I am new to the world of http, https,GEt,..
can you please explain me how these things work?

have tried playing around with the fona library from adafruit
in example LTE_demo have changed line 1037 -> 1057

#else
        // Construct the appropriate URL's and body, depending on request type
        // Use IMEI as device ID for this example

        // GET request
        sprintf(URL, "dweet.io/dweet/for/%s?temp=%s&batt=%i", imei, tempBuff, battLevel); // No need to specify http:// or https://
        //        sprintf(URL, "http://dweet.io/dweet/for/%s?temp=%s&batt=%i", imei, tempBuff, battLevel); // But this works too

        if (!fona.postData("GET","script.google.com/macros/s/AKfycbzZxVDqD5KqSsrS605ROUGZ7IaeFyB9_vlWviwSWO21s7UotwNF4EQbg43iLcbLVHLWdA/exec?temperature=10" ))
          Serial.println(F("Failed to complete HTTP GET..."));

        // POST request
        /*
          sprintf(URL, "http://dweet.io/dweet/for/%s", imei);
          sprintf(body, "{\"temp\":%s,\"batt\":%i}", tempBuff, battLevel);

          if (!fona.postData("POST", URL, body)) // Can also add authorization token parameter!
          Serial.println(F("Failed to complete HTTP POST..."));
        */

#endif

see my serial monitor:

-------------------------------------
[?] Print this menu
[a] Read the ADC; 2.8V max for SIM800/808, 0V-VBAT for SIM7000 shield
[b] Read supply voltage
[C] Read the SIM CCID
[U] Unlock SIM with PIN code
[i] Read signal strength (RSSI)
[n] Get network status
[1] Get network connection info
[c] Make phone Call
[A] Get call status
[h] Hang up phone
[p] Pick up phone
[N] Number of SMS's
[r] Read SMS #
[R] Read all SMS
[d] Delete SMS #
[s] Send SMS
[u] Send USSD
[y] Enable local time stamp (SIM800/808/70X0)
[Y] Enable NTP time sync (SIM800/808/70X0)
[t] Get network time
[G] Enable cellular data
[g] Disable cellular data
[l] Query GSMLOC (2G)
[w] Read webpage
[W] Post to website
[2] Post to dweet.io - 2G / LTE CAT-M / NB-IoT
[3] Post to dweet.io - 3G / 4G LTE
[O] Turn GPS on (SIM808/5320/7XX0)
[o] Turn GPS off (SIM808/5320/7XX0)
[L] Query GPS location (SIM808/5320/7XX0)
[E] Raw NMEA out (SIM808)
[S] Create serial passthru tunnel
-------------------------------------

FONA> 2
	---> AT+CBC
	<--- +CBC: 0,66,3860
	---> AT+HTTPTERM
	<--- ERROR
	---> AT+HTTPINIT
	<--- OK
	---> AT+HTTPPARA="CID",1
	<--- OK
	---> AT+HTTPPARA="URL","script.google.com/macros/s/AKfycbzZxVDqD5KqSsrS605ROUGZ7IaeFyB9_vlWviwSWO21s7UotwNF4EQbg43iLcbLVHLWdA/exec?temperature=10"
	<--- OK
	---> AT+HTTPACTION=0
	<--- OK
HTTP status: 601
Data length: 0
Failed to complete HTTP GET...

but doesn't seem to work?

Hi there
got a bit further My previous mistake was i didn't switch on the gprs now I did but end up with http error 301 page permantly moved. see serial output :

	---> AT+CGREG?
	<--- +CGREG: 0,1
Network status 1: Registered (home)
FONA> G
	---> AT+CIPSHUT
	<--- SHUT OK
	---> AT+CGATT=1
	<--- OK
	---> AT+SAPBR=3,1,"CONTYPE","GPRS"
	<--- OK
	---> AT+SAPBR=3,1,"APN","my apn"
	<--- OK
	---> AT+CSTT="my apn"
	<--- OK
	---> AT+SAPBR=1,1
	<--- OK
	---> AT+CIICR
	<--- OK
FONA> 2
	---> AT+CBC
	<--- +CBC: 0,66,3865
	---> AT+HTTPTERM
	<--- ERROR
	---> AT+HTTPINIT
	<--- OK
	---> AT+HTTPPARA="CID",1
	<--- OK
	---> AT+HTTPPARA="URL","http://script.google.com/macros/s/AKfycbzZxVDqD5KqSsrS605ROUGZ7IaeFyB9_vlWviwSWO21s7UotwNF4EQbg43iLcbLVHLWdA/exec?temperature=10"
	<--- OK
	---> AT+HTTPACTION=0
	<--- OK
HTTP status: 301
Data length: 311
Failed to complete HTTP GET...

read somewhere that has to do with https

client is not sending a User-Agent header in the request, so Google knows your client is not a browser, and might not be issuing the redirect in your case. But in a real browser, it does

can someone please help?

Since you are not hiring me on Guru, I'll give you a FREE solution here itself.

You need to mention https:// before the URL

So

 // GET request
        sprintf(URL, "https://dweet.io/dweet/for/%s?temp=%s&batt=%i", imei, tempBuff, battLevel); // need to specify http:// or https://

        if (!fona.postData("GET","https://script.google.com/macros/s/AKfycbzZxVDqD5KqSsrS605ROUGZ7IaeFyB9_vlWviwSWO21s7UotwNF4EQbg43iLcbLVHLWdA/exec?temperature=10" ))
          Serial.println(F("Failed to complete HTTP GET..."));

thank you so much, have tried but now error 601 see serial below:

-------------------------------------
[?] Print this menu
[a] Read the ADC; 2.8V max for SIM800/808, 0V-VBAT for SIM7000 shield
[b] Read supply voltage
[C] Read the SIM CCID
[U] Unlock SIM with PIN code
[i] Read signal strength (RSSI)
[n] Get network status
[1] Get network connection info
[c] Make phone Call
[A] Get call status
[h] Hang up phone
[p] Pick up phone
[N] Number of SMS's
[r] Read SMS #
[R] Read all SMS
[d] Delete SMS #
[s] Send SMS
[u] Send USSD
[y] Enable local time stamp (SIM800/808/70X0)
[Y] Enable NTP time sync (SIM800/808/70X0)
[t] Get network time
[G] Enable cellular data
[g] Disable cellular data
[l] Query GSMLOC (2G)
[w] Read webpage
[W] Post to website
[2] Post to dweet.io - 2G / LTE CAT-M / NB-IoT
[3] Post to dweet.io - 3G / 4G LTE
[O] Turn GPS on (SIM808/5320/7XX0)
[o] Turn GPS off (SIM808/5320/7XX0)
[L] Query GPS location (SIM808/5320/7XX0)
[E] Raw NMEA out (SIM808)
[S] Create serial passthru tunnel
-------------------------------------

FONA> i
	---> AT+CSQ
	<--- +CSQ: 25,99
RSSI = 25: -64 dBm
FONA> n
	---> AT+CGREG?
	<--- +CGREG: 0,1
Network status 1: Registered (home)
FONA> 2
	---> AT+CBC
	<--- +CBC: 0,66,3861
	---> AT+HTTPTERM
	<--- ERROR
	---> AT+HTTPINIT
	<--- OK
	---> AT+HTTPPARA="CID",1
	<--- OK
	---> AT+HTTPPARA="URL","https://script.google.com/macros/s/AKfycbzZxVDqD5KqSsrS605ROUGZ7IaeFyB9_vlWviwSWO21s7UotwNF4EQbg43iLcbLVHLWdA/exec?temperature=10"
	<--- OK
	---> AT+HTTPACTION=0
	<--- OK
HTTP status: 601
Data length: 0
	---> AT+HTTPREAD
	<--- OK
	<--- 
	---> AT+HTTPTERM
	<--- OK
FONA> ```

are you sure GPRS is on?

if this doesnt solve the issue hire me I will solve it in 2 hours max

The answer is to execute AT+HTTPSSL=1 after setting the URL. Hope this helps.

was not on but now is on still getting ERRO 603

[?] Print this menu
[a] Read the ADC; 2.8V max for SIM800/808, 0V-VBAT for SIM7000 shield
[b] Read supply voltage
[C] Read the SIM CCID
[U] Unlock SIM with PIN code
[i] Read signal strength (RSSI)
[n] Get network status
[1] Get network connection info
[c] Make phone Call
[A] Get call status
[h] Hang up phone
[p] Pick up phone
[N] Number of SMS's
[r] Read SMS #
[R] Read all SMS
[d] Delete SMS #
[s] Send SMS
[u] Send USSD
[y] Enable local time stamp (SIM800/808/70X0)
[Y] Enable NTP time sync (SIM800/808/70X0)
[t] Get network time
[G] Enable cellular data
[g] Disable cellular data
[l] Query GSMLOC (2G)
[w] Read webpage
[W] Post to website
[2] Post to dweet.io - 2G / LTE CAT-M / NB-IoT
[3] Post to dweet.io - 3G / 4G LTE
[O] Turn GPS on (SIM808/5320/7XX0)
[o] Turn GPS off (SIM808/5320/7XX0)
[L] Query GPS location (SIM808/5320/7XX0)
[E] Raw NMEA out (SIM808)
[S] Create serial passthru tunnel
-------------------------------------

FONA> i
	---> AT+CSQ
	<--- +CSQ: 20,99
RSSI = 20: -74 dBm
FONA> n
	---> AT+CGREG?
	<--- +CGREG: 0,1
Network status 1: Registered (home)
FONA> G
	---> AT+CIPSHUT
	<--- SHUT OK
	---> AT+CGATT=1
	<--- OK
	---> AT+SAPBR=3,1,"CONTYPE","GPRS"
	<--- OK
	---> AT+SAPBR=3,1,"APN","net.hotm"
	<--- OK
	---> AT+CSTT="net.hotm"
	<--- OK
	---> AT+SAPBR=1,1
	<--- OK
	---> AT+CIICR
	<--- OK
FONA> 2
	---> AT+CBC
	<--- +CBC: 0,66,3864
	---> AT+HTTPTERM
	<--- ERROR
	---> AT+HTTPINIT
	<--- OK
	---> AT+HTTPPARA="CID",1
	<--- OK
	---> AT+HTTPPARA="URL","https://script.google.com/macros/s/AKfycbzZxVDqD5KqSsrS605ROUGZ7IaeFyB9_vlWviwSWO21s7UotwNF4EQbg43iLcbLVHLWdA/exec?temperature=10"
	<--- OK
	---> AT+HTTPACTION=0
	<--- OK
HTTP status: 603
Data length: 0
	---> AT+HTTPREAD
	<--- OK
	<--- 
	---> AT+HTTPTERM
	<--- OK

do what you're told here

"The answer is to execute AT+HTTPSSL=1 after setting the URL. Hope this helps"

tried didnt help

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