Hi,
Been trying to append data to end of Google Sheets.
This is my Update function.
"STOPPAGES" is the worksheet.
Keep getting error....
The logs display the correct strings...
Where am I going wrong?
Regards.
NOTE: I've "starred" the SheetID.
Been trying to append data to end of Google Sheets.
This is my Update function.
B4X:
Private Sub UpdateSheetData(sValueRange As String, sValues As String)
oauth2.GetAccessToken
Wait For OAuth2_AccessTokenAvailable (Success As Boolean, Token As String)
If Success = False Then
ToastMessageShow("Error accessing account.", True)
Return
End If
Dim sSTR As String = "https://sheets.googleapis.com/v4/spreadsheets/" & sheetID & _
"/values/" & sValueRange & _
":append?valueInputOption=RAW"
Log("sSTR: " & sSTR & CRLF & " sValues: " & "{""values"":[[" & sValues & "]]}")
Dim j As HttpJob
j.Initialize("", Me)
j.PutString(sSTR, "{""values"":[[" & sValues & "]]}")
j.GetRequest.SetHeader("Authorization", "Bearer " & Token)
j.GetRequest.SetHeader("Accept", "application/json")
j.GetRequest.SetContentType("application/json")
Wait For (j) JobDone(j As HttpJob)
If j.Success = True Then
Log("Response Length:" & j.GetString.Length & " bytes")
Log(j.GetString)
End If
j.Release
End Sub
Keep getting error....
B4X:
404. That’s an error.
The requested URL /v4/spreadsheets/***************************/values/STOPPAGES:append?valueInputOption=RAW was not found on this server. That’s all we know.
The logs display the correct strings...
B4X:
sSTR: https://sheets.googleapis.com/v4/spreadsheets/***************************/values/STOPPAGES:append?valueInputOption=RAW
sValues: {"values":[["Feb-21","11-2-21"]]}
Where am I going wrong?
Regards.
NOTE: I've "starred" the SheetID.
Last edited: