Skip to content

FAILED_PRECONDITION on shared file #732

@SaladBreaker

Description

@SaladBreaker

Describe the bug
I tried to use the sheet = gc.open_by_url() function to access a xlsx that was shared with my account (My email got full access to the document, not via shared url). The credentials are correctly configure on the email that has permissions, but the email is not the owner.

The documnet is a .XLXS can this be the problem?

The error i get:
gspread.exceptions.APIError: {'code': 400, 'message': 'This operation is not supported for this document', 'status': 'FAILED_PRECONDITION'}

To Reproduce
Steps to reproduce the behavior:

  1. Create a document on an account X
  2. Share it with an account Y
  3. Configure the API on the account Y
  4. Try to access the file created by X

Expected behavior
I expect the file to open as if I am the owner of it.

Code example*
If applicable, provide a code example to help explain your problem.

Environment info:

  • Operating System [e.g. Linux, Windows, macOS]: Linux
  • Python version: 3.6.9
  • gspread version: 3.3.0

Stack trace or other output that would be helpful
Traceback (most recent call last):
File "/home/vlad/Documents/Projects/SYneto/tutorials/GoogleDrTest/.venv/lib/python3.6/site-packages/gspread/models.py", line 90, in title
return self._properties['title']
KeyError: 'title'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "drive.py", line 26, in
downlaodSheetFile()
File "/home/vlad/Documents/Projects/SYneto/tutorials/GoogleDrTest/operations/downloader.py", line 61, in downlaodSheetFile
print(sheet)
File "/home/vlad/Documents/Projects/SYneto/tutorials/GoogleDrTest/.venv/lib/python3.6/site-packages/gspread/models.py", line 121, in repr
repr(self.title),
File "/home/vlad/Documents/Projects/SYneto/tutorials/GoogleDrTest/.venv/lib/python3.6/site-packages/gspread/models.py", line 92, in title
metadata = self.fetch_sheet_metadata()
File "/home/vlad/Documents/Projects/SYneto/tutorials/GoogleDrTest/.venv/lib/python3.6/site-packages/gspread/models.py", line 255, in fetch_sheet_metadata
r = self.client.request('get', url, params=params)
File "/home/vlad/Documents/Projects/SYneto/tutorials/GoogleDrTest/.venv/lib/python3.6/site-packages/gspread/client.py", line 79, in request
raise APIError(response)
gspread.exceptions.APIError: {'code': 400, 'message': 'This operation is not supported for this document', 'status': 'FAILED_PRECONDITION'}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions