Google Sheets API Error: invalid_user: Robot is missing a project number

Viewed 2308

I am getting invalid_user: Robot is missing a project number. when trying to access google sheets using the service account created in my project. I followed the exact steps mention in the URL: https://www.twilio.com/blog/2017/02/an-easy-way-to-read-and-write-to-a-google-spreadsheet-in-python.html

It seems to work for everyone else, and surprisingly I am not able to find any solution on the web.

Accessing the data using oAuth credentials is working good for me, but I want to deploy the code to AWS Lambda and hence need server to server access.

2 Answers

The problem was me replacing the client_email by my email ID. Rather, I should have shared the spreadsheet with the service account email ID!

I had the same issue and solved it by changing the scope value:

scope = ['https://spreadsheets.google.com/feeds'] to be replaced by scope = ['https://www.googleapis.com/auth/drive']

I hope it helps you...

Related