Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Google Sheets API. The request is missing a valid API key. [403]

I'm using .net package Google.Apis.Sheets.v4 Client Library. Everything was fine, but last time (about a week ago) there is an error: The request is missing a valid API key. [403] when I'm trying to batchGet with 150+ ranges in a query. If I split my query to 25 ranges in a single query, it could be ok, also it could return the same error at one of them. Sometimes it works without any splitting, but usually I get an error. I'm absolutely sure that my API key is valid and I've tried another keys, another spreadsheets, but nothing has changed.

like image 794
lagrange- Avatar asked May 29 '18 18:05

lagrange-


People also ask

Do you have to pay for Google Sheets API?

All use of the Google Sheets API is available at no additional cost. Exceeding the quota request limits doesn't incur extra charges and your account is not billed.


1 Answers

Some of the answers in this SO post have point to handle this 403 error.

First thing, make sure that you have permission to call the specific spreadsheet and enable the Sheets API in your developer console. Another thing, try to change the privacy settings of this spreadsheet to public and checked if you can access it now. You will usually get 403 error when you have missed or incorrect configuration in Authorizing Requests. Make sure to use proper scope if you are authorizing requests with OAuth 2.0

like image 116
MαπμQμαπkγVπ.0 Avatar answered Sep 29 '22 20:09

MαπμQμαπkγVπ.0