This is an example from their docs:
import gspread
credentials = {
"type": "service_account",
"project_id": "api-project-XXX",
"private_key_id": "2cd … ba4",
"private_key": "-----BEGIN PRIVATE KEY-----\nNrDyLw … jINQh/9\n-----END PRIVATE KEY-----\n",
"client_email": "[email protected]",
"client_id": "473 … hd.apps.googleusercontent.com",
...
}
gc = gspread.service_account_from_dict(credentials)
sh = gc.open("Example spreadsheet")
print(sh.sheet1.get('A1'))
but what exactly goes in their "Example spreadsheet"?
When I copy paste the entire link from my browser, it says Spreadsheet not found. If I copy just the gid, I get the same output. If I copy the middle part, I still get the same error :(
You need to use the title of the spreadsheet as it appears in Google Docs, as documented here.