Updating cell in Google Spreadsheets returns error “Missing resource version ID” / “The remote server returned an error: (400) Bad Request.”

大兔子大兔子 提交于 2019-12-06 01:01:33
Paul DB

We hit this same issue about a week ago when it seems that Google flipped over all spreadsheets to the "new" format.
This goes for new ones created via the GData api as well. 400 errors everywhere.

I dug into the reports across the GData variant libraries (Python, Java, .Net etc) and eventually found this little nugget: https://stackoverflow.com/a/23438381/1685090

Setting the Etag property to "*" is the answer :)

To be clear, we're setting WorksheetEntry.Etag when we want to run Update() on a worksheet, and we're also setting CellEntry.Etag when doing batch updates via SpreadsheetsService.Batch().

So far it seems to work fine with Google's "new" spreadsheets.

One catch with this approach is that any concurrent/merging operations will be foregone - essentially you are telling Google that your update must blow away any other concurrent prior value in the cells.

Another way I solved this is through adding an additional HTTP header

If-Match: *

Which says overwrite anything.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!