NicLovin
NicLovin

Reputation: 355

Issues getting started with google sheets API

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:

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?

Upvotes: 0

Views: 156

Answers (1)

anarchy
anarchy

Reputation: 5204

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')

Upvotes: 1

Related Questions