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

Worksheet rows variable gets incremented even when add_rows method fails #189

Closed
a-cid opened this issue Feb 28, 2018 · 0 comments
Closed

Comments

@a-cid
Copy link

a-cid commented Feb 28, 2018

I'm doing some work on a sheet that had some protected ranges, so it wouldn't let me add rows. I noticed the rows variable was still increasing even though no rows were actually added to the sheet. See console output bellow:

>>> wks.rows
982
>>> wks.add_rows(1)
Traceback (most recent call last):
  File "<input>", line 1, in <module>
  File "C:\Python27\lib\site-packages\pygsheets\worksheet.py", line 479, in add_rows
    self.resize(rows=self.rows + rows, cols=self.cols)
  File "C:\Python27\lib\site-packages\pygsheets\worksheet.py", line 472, in resize
    self.link()
  File "C:\Python27\lib\site-packages\pygsheets\worksheet.py", line 134, in link
    self.client.update_sheet_properties(self.spreadsheet.id, self.jsonSheet['properties'])
  File "C:\Python27\lib\site-packages\pygsheets\client.py", line 336, in update_sheet_properties
    return self.sh_batch_update(spreadsheet_id, request, None, batch)
  File "C:\Python27\lib\site-packages\pygsheets\client.py", line 409, in sh_batch_update
    return self._execute_request(spreadsheet_id, final_request, batch)
  File "C:\Python27\lib\site-packages\pygsheets\client.py", line 421, in _execute_request
    response = request.execute()
  File "C:\Python27\lib\site-packages\oauth2client\_helpers.py", line 133, in positional_wrapper
    return wrapped(*args, **kwargs)
  File "C:\Python27\lib\site-packages\googleapiclient\http.py", line 844, in execute
    raise HttpError(resp, content, uri=self.uri)
HttpError: <HttpError 400 when requesting https://sheets.googleapis.com/v4/spreadsheets/1hm8hqmOU0auL4CKTvzpSLhtabDK9Yd5aDPF_XQHvRqk:batchUpdate?alt=json returned "Invalid requests[0].updateSheetProperties: You are trying to edit a protected cell or object. Please contact the spreadsheet owner to remove protection if you need to edit.">
>>> wks.rows
983
nithinmurali added a commit that referenced this issue May 1, 2018
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

1 participant