burnash / gspread

Google Sheets Python API
https://docs.gspread.org
MIT License
7.1k stars 949 forks source link

Spreadsheet not found issue #277

Closed deepakag123 closed 9 years ago

deepakag123 commented 9 years ago

Sorry If I am doing something wrong here . I am unable to open any spreadsheet - tried using name, key and url /Library/Frameworks/Python.framework/Versions/2.7/bin/python2.7 /Users/deepakambattu/PycharmProjects/untitled/test Traceback (most recent call last): File "/Users/deepakambattu/PycharmProjects/untitled/test", line 13, in wks = gc.open('test') File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/gspread/client.py", line 150, in open raise SpreadsheetNotFound gspread.exceptions.SpreadsheetNotFound

my code

import json import gspread from oauth2client.client import SignedJwtAssertionCredentials

json_key = json.load(open('json.txt')) scope = ['https://spreadsheets.google.com/feeds']

credentials = SignedJwtAssertionCredentials(json_key['client_email'], json_key['private_key'], scope)

gc = gspread.authorize(credentials)

wks = gc.open('test')

Is there a known issue in accessing the spreadsheets?

ghost commented 9 years ago
json_key = json.load(open('json.txt'))

@deepakag123 your json_key or JSON file should have .json extension not .txt.

not only this, wks = gc.open('test') will not open the sheet for you physically, like a window popping out.

When you run gc.open('title'), you are essentially, connected to your spreadsheet using this script, it just means connection open (). Now, you can play aroung by adding what ever data you want to add. Only, after adding some data you can see, your cells in spreadsheet populating something like a 'popcorn'. Till then, nothing can be seen.

rybo449 commented 9 years ago

@ShivaShinde I'm having the same issue as @deepakag123

    json_key = json.load(open(abspath(join(abspath(eliot.settings.__file__), "..", "..", "data", "client_secrets.json"))))
    scope = ['https://spreadsheets.google.com/feeds']
    credentials = SignedJwtAssertionCredentials(json_key['client_email'], json_key['private_key'], scope)
    gc = gspread.authorize(credentials)
    sh1 = gc.open()

It turns out that my drive is empty. Is there a way to find out if you are connected to the right drive? Thanks a lot!

ghost commented 9 years ago

@rybo449 by drive, you mean google drive (sheet) right?

sh1 = gc.open()

where is the name of the sheet here?

wks = gc.open('test') will not open the sheet for you physically, like a window popping out.

When you run gc.open('title'), you are essentially, connected to your spreadsheet using this script, it just means connection open (). Now, you can play aroung by adding what ever data you want to add. Only, after adding some data you can see, your cells in spreadsheet populating something like a 'popcorn'. Till then, nothing can be seen.

rybo449 commented 9 years ago

@ShivaShinde Thanks for replying so fast. I figured out the issue. I had to share the spreadsheets with my client_address which did not contain any spreadsheets. Now it works like a charm :)

chrisspen commented 9 years ago

I'm also getting this error. I followed the steps in the oauth docs for enabling Drive API access, and my script can login just fine, but trying to retrieve any spreadsheet by title or key throws a SpreadsheetNotFound exception.

@rybo449 What do you mean you had to share it with your "client_address"? You mean your literally IP address? Google Drive doesn't support sharing to specific IP addresses.

tacy commented 9 years ago

@chrisspen json_key['client_email']

msuozzo commented 9 years ago

It seems as if this issue has been resolved. Anyone have objections to it being closed?

ibushong commented 9 years ago

I also ran into this issue, and sharing the sheet with the client_email also solved it.

This should be added to the README as it's not obvious.

burnash commented 9 years ago

@ibushong It's in the guide already (see right before the Troubleshooting section.) What do you think is a better way to put it?

ibushong commented 9 years ago

Wow. My mistake. Totally missed that!

Arjay7891 commented 8 years ago

hah I also totally missed this and just spend an hour searching for the solution! burnash, I don't think it's a matter of the choice of words, it's probably more that everybody stops reading after the "If using oauth2client < 2.0.0" disclaimer.

could be good to highlight step 7 more by putting it before the "If using oauth2client < 2.0.0" with an "IMPORTANT!!!!!" disclaimer or something, it's quite easy to miss right now

physicsistic commented 7 years ago

Understand that the issue is closed, but want to echo the above comment by @Arjay7891, can we change the documentation for point #7 to be in the troubleshooting section or something so that it is not so easy to overlook?

vallettea commented 7 years ago

Also missed it and lost two hours. Should be mentioned in the readme.

s3afroze commented 5 years ago

The documentation is very well written. I will see if I can update this because I was stuck on that issue as well and apparently many people new to the library have the same experience.

Share the file using the email in your token.

If this does not work, there might be a problem with the name(my experience)

The name of the file should match up with what you in gc.open(file) and not the sheet name for instance.