Search code examples
pythongoogle-app-enginegoogle-sheetsgoogle-drive-api

InvalidClientSecretsError - df2gspread - Panda - Google Sheet


I am a newbie with Python (started learning it 2 weeks ago) and I am struggling with this task.

I am trying to export a data-frame from Panda to a Google Spreadsheet. Yet, after having followed all the necessary steps (https://github.com/maybelinot/df2gspread) I keep on having the same error:

InvalidClientSecretsError: ('Error opening file', 'C:\Users\ User/.gdrive_private', 'No such file or directory', 2)

The code I am using is:

from df2gspread import df2gspread as d2g
import pandas as pd

spreadsheet = 'C:\Users\User\Google Drive\Marketing Team'

wks = d2g.upload(df_all_daily_campaign_y, wks_name='Example worksheet')

Please don´t give anything for granted with me since I have very limited knowledge of this topic !

I have seen this question posted elsewhere on the internet, but with no posted answers! Any help would be greatly appreciated!


Solution

  • The error is indicating that the necessary OAuth file that contains client secrets in C:\Users\ User/.gdrive_private cannot be found.

    Please check completeness of your Client Secrets. As mentioned in the given documentation,

    That can be error prone, along with it being an incomplete picture of all the information that is needed to get OAuth 2.0 working, which requires knowing all the endpoints and configuring a Redirect Endpoint.

    More information and helpful codes can be found in GitHub and oauth2client.clientsecrets.