+1 vote

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!

Godot version v3.2.3-stable_win64
in Engine by (909 points)

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.

You need to 'allow for' access your sheet.

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

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.

Please log in or register to answer this question.

Welcome to Godot Engine Q&A, where you can ask questions and receive answers from other members of the community.

Please make sure to read How to use this Q&A? before posting your first questions.
Social login is currently unavailable. If you've previously logged in with a Facebook or GitHub account, use the I forgot my password link in the login box to set a password for your account. If you still can't access your account, send an email to webmaster@godotengine.org with your username.