Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Can't open worksheet without edit permissions #167

Closed
anentropic opened this issue Sep 15, 2014 · 1 comment
Closed

Can't open worksheet without edit permissions #167

anentropic opened this issue Sep 15, 2014 · 1 comment

Comments

@anentropic
Copy link

I wanted to import data from a spreadsheet where I had view only, no edit permissions.

I was able to get_doc successfully but when I try to get_worksheet I get the following error:

/myproject/lib/python2.7/site-packages/gspread/models.pyc in get_worksheet(self, index)
    146         """
    147         if not self._sheet_list:
--> 148             self._fetch_sheets()
    149         try:
    150             return self._sheet_list[index]

/myproject/lib/python2.7/site-packages/gspread/models.pyc in _fetch_sheets(self)
     64         feed = self.client.get_worksheets_feed(self)
     65         for elem in feed.findall(_ns('entry')):
---> 66             self._sheet_list.append(Worksheet(self, elem))
     67
     68     def add_worksheet(self, title, rows, cols):

/myproject/lib/python2.7/site-packages/gspread/models.pyc in __init__(self, spreadsheet, element)
    168         self._element = element
    169         self.version = self._get_link(
--> 170             'edit', element).get('href').split('/')[-1]
    171
    172     def __repr__(self):

/myproject/lib/python2.7/site-packages/gspread/models.pyc in _get_link(self, link_type, feed)
    209     def _get_link(self, link_type, feed):
    210         return finditem(lambda x: x.get('rel') == link_type,
--> 211                         feed.findall(_ns('link')))
    212
    213     def _fetch_cells(self):

/myproject/lib/python2.7/site-packages/gspread/utils.pyc in finditem(func, seq)
     16
     17     """
---> 18     return next((item for item in seq if func(item)))
     19
     20

StopIteration:

If I save a copy of the spreadsheet and open the copy, where I am owner with edit permissions, then I can get_worksheet successfully. So I believe it is due to permissions.

I realise may not be possible due to Google API, but I'd hoped to still be able to do non-editing operations.

@msuozzo
Copy link
Collaborator

msuozzo commented Oct 15, 2015

Duplicate of #175. This behavior is currently unsupported but we're working towards adding it.

@msuozzo msuozzo closed this as completed Oct 15, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants