Http request from google sheets

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By Help me please

Overview

HI!

Sometimes ago I tried making an http request from Google Sheets but I failed to do so now I am trying to do it again but getting some unexpected results.


What I did

I have created a Google Sheets and as per this Site I had gathered all the information like spreadsheetId. And I had made my scene tree as follow

Node
->HTTPRequest
->Button

and connected pressed and request_completed signals of Button and of HTTPRequest respectively to the root.

My code is as follow

extends Node

const spreadsheetId := "<My sreadsheetId>"

const URL := "https://sheets.googleapis.com/v4/spreadsheets/%s/values/Sheet1!A1:D5" %spreadsheetId


func _on_HTTPRequest_request_completed(result, response_code, headers, body):
	print(body)
	var json = JSON.parse(body.get_string_from_utf8())
	print(json.result)


func _on_Button_pressed():
	$HTTPRequest.request(URL, [], false, HTTPClient.METHOD_GET)

What I got as result

I had used this method and what I found in my debugger is as follows:-

[PoolByteArray]
{error:{code:403, message:The request is missing a valid API key., status:PERMISSION_DENIED}}

Issue

I don’t know what is going on and what should I do. Please guide me! I had done a lot of hard work to format this question
Thanks in advance!

It could be that Google sheets stops these sort of things, and you can’t extract text/data from the spreadsheet, however, I don’t know.

Snail0259 | 2021-07-27 05:51

You need to ‘allow for’ access your sheet.

clemens.tolboom | 2021-07-27 07:05

I think I have already done that. In the drive I have changed the sharing to Anyone With This Link Can Edit

Help me please | 2021-07-27 08:00

Anyone With This Link Can Edit is for users … your Godot application is using the API. If possible try the JS version. The prerequisites (Step 1 bullet 3 and 4) could help you further.

clemens.tolboom | 2021-07-27 09:18