my first SO question so I hope that I don't anger the group ;-)
Using gspread 0.4.0 and Python 2.7, I can access pages in my Google Sheet, can read data, and can change the content of cells using update_cell(). However, attempts to insert a row or append a row to the end of the sheet are both met with the following error:
File "c:\Python27\lib\site-packages\gspread\models.py", line 525, in append_row
self.add_rows(1)
File "c:\Python27\lib\site-packages\gspread\models.py", line 507, in add_rows
self.resize(rows=self.row_count + rows)
File "c:\Python27\lib\site-packages\gspread\models.py", line 500, in resize
self._element = self.client.put_feed(uri, ElementTree.tostring(feed))
File "c:\Python27\lib\site-packages\gspread\client.py", line 212, in put_feed
r = self.session.put(url, data, headers=headers)
File "c:\Python27\lib\site-packages\gspread\httpsession.py", line 85, in put
return self.request('PUT', url, data=data, **kwargs)
File "c:\Python27\lib\site-packages\gspread\httpsession.py", line 72, in request
response.status_code, response.content))
spread.exceptions.HTTPError: 400: The reference to entity "format" must end with the ';' delimiter.
I found one hit on the gspread Github page that referenced this error and that user had apparently seen the issue go away when he removed permissions from his sheet. I have removed permissions from mine but the error persists.
I am not the most savvy user of HTTP to update data, and I think that's what gspread is doing here, so I am stumped. There's a lot of """ stuff here that makes my eyes bleed.
Thanks to the collective for any advice/assistance!
OK, so in my case it turned out that an unescaped ampersand was being passed to gspread's models.resize() function. I do not know how to solve the unescaped ampersand at its source, so I just replaced it with the proper escaped characters and I'm off to the races.
Specifically, I modified models.py at line 500 (in the resize() function) -
self._element = self.client.put_feed(uri, ElementTree.tostring(feed).replace("&format","&format"))