I am writing a python(ver 3) script to access google doc using gspread.
1) import gspread
2) from oauth2client.service_account import ServiceAccountCredentials
3) scope = ['https://spreadsheets.google.com/feeds']
4) credentials = ServiceAccountCredentials.from_json_keyfile_name(r'/path/to/jason/file/xxxxxx.json',scope)
5) gc = gspread.authorize(credentials)
6) wks = gc.open("test").sheet1
test is a google sheet which seems to be opened and read fine but if I try to read from a Office excel file it gives me error.here is what they look:
The folder which test and mtg are under is shared with the email I got in json file.Also both files were shared with that email.
Tried:
wks = gc.open("mtg.xls").sheet1
and
wks = gc.open("mtg.xls").<NameOfFirstSheet>
and
wks = gc.open("mtg").<NameOfFirstSheet>
error:
/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/site-packages/gspread/client.py", line 152, in open raise SpreadsheetNotFound gspread.exceptions.SpreadsheetNotFound
I was getting this as I had missed step 4 here
Go to your spreadsheet and share it with a client_email from the step above. Otherwise you’ll get a SpreadsheetNotFound exception when trying to access this spreadsheet with gspread.