Accessing Google Sheets Api with Python

Use this as your scope:

scope = ['https://spreadsheets.google.com/feeds', 'https://www.googleapis.com/auth/drive']

Before calling the "ServiceAccountCredentials"

You will need to enable the Google Drive API in the "console.cloud.google" as well as the sheets API.


If you look at the google API scopes documentation, the scope url you are using is not referenced anywhere. This may be the problem. Try changing the scope url to https://www.googleapis.com/auth/spreadsheets.

Also, make sure the spreadsheet API is correctly enabled in your project in the google developer console.

Alternatively, you could try the Sheetfu library (I'm the author), that handles the scopes for you.


I believe google drive API endpoint needs to be included in your scope. I was writing data from Mailchimp API to Google Sheet.

Check this out: https://www.youtube.com/watch?v=7I2s81TsCnc> It was helpful for me.

scope = ['https://spreadsheets.google.com/feeds', 'https://www.googleapis.com/auth/drive']