I am trying to use python gsheets
library to download a google sheets document as a csv
file using the following tutorial: (https://pypi.org/project/gsheets/)
I have done all of the following:
pip install gsheets
json
file of the client ID I created and saved it into my users folder as: client_secrets.json
According to the example project I'm following another file, named storage.json in this example, will be created after successful authorization to cache OAuth data.
I then try creating a Sheets object:
>>> from gsheets import Sheets
>>> sheets = Sheets.from_files('~/client_secrets.json', '~/storage.json')
But when I do this I get the following error: FileNotFoundError: [Errno 2] No such file or directory: 'C:/Users/client_secrets.json'
I know that the client_secrets.json
is in my user directory and properly spelled, why else would I be getting this error?
I am guessing you are using windows, meaning the Users is not your actual directory, it is actually C:/Users/username/
You could have Documents and Desktop and Downloads folders in there.
Try this instead of using the tilde.
from gsheets import Sheets
sheets = Sheets.from_files(r'C:\Users\username\client_secrets.json', r'C:\Users\username\storage.json')