OiO.lk Community platform!

Oio.lk is an excellent forum for developers, providing a wide range of resources, discussions, and support for those in the developer community. Join oio.lk today to connect with like-minded professionals, share insights, and stay updated on the latest trends and technologies in the development field.
  You need to log in or register to access the solved answers to this problem.
  • You have reached the maximum number of guest views allowed
  • Please register below to remove this limitation

403 insufficient insufficient authentication scopes when sending df to GSgeets

  • Thread starter Thread starter ppp147
  • Start date Start date


I have a script that collects data from an API and sends it to Google Sheets. However, every time I run it I get the 403 insufficient auth scopes error. My service account has Editor and Viewer roles, I even added Owner permissions for testing purposes but the code still fails with the same error. I have service account json in the same folder as my script thus i assumed the path is pretty straightforward. Google Sheets API enabled. What could be wrong?

import gspread
from google.oauth2.service_account import Credentials
import os

os.environ["GOOGLE_APPLICATION_CREDENTIALS"] = "service_account.json"

SCOPES = ['https://www.googleapis.com/auth/spreadsheets']

creds = Credentials.from_service_account_file(os.environ["GOOGLE_APPLICATION_CREDENTIALS"], scopes=SCOPES)

gc = gspread.authorize(creds)

worksheet = gc.open("spreadsheet_name")
sheet1 = worksheet.sheet1
sheet1.update([df.columns.values.tolist()] + df.fillna('').values.tolist())

Continue reading...

Latest posts

Alfredo Augusto Petri