Issues accessing some Google sheet aspects from HTTP APIs

What I’m trying to do:

Trying to manipulate Google sheets in an HTTP API, for example, trying to add a row by invoking “add_row”, which fails, logging an error (similar to what is pasted below). Retrieving the spreadsheet’s header line by invoking “fields” does not work either. One can however obtain all the data in the sheet using “rows” (which is a superset of the data returned by “fields”), showing that the sheet was correctly linked and is accessible in principle. This seems to therefore most likely be a bug - but as requested, I am posting this as a Q+A topic first.

What I’ve tried and what’s not working:

Having created a new Material Design (not that this is likely to matter) app, linked a Google account, created and linked a sheet “Demo Bug” containing “Sheet1” as “demo_bug”, the sample code below logs:

TypeError: Wrong number of arguments (2) passed to anvil.private.google.sheets.v4.list_cells(). Did you pass keyword arguments as positional arguments, or vice versa?
at , line NaN
called from /libanvil/anvil/google/sheets.py, line 208
called from /libanvil/anvil/google/sheets.py, line 169
called from /libanvil/anvil/google/sheets.py, line 152
called from ServerModule1, line 23
called from /libanvil/anvil/_server.py, line 1336

Changing “fields” to “rows” in the sample code below returns the contents of the spreadsheet without logging errors. This illustrates that the basics of linking an account / sheet and accessing it from an HTTP API do work. Only code that directly or indirectly invokes “list_cells” seems to exhibit issues.

I tried to look at the open source runtime, e.g. at:

https://github.com/anvil-works/anvil-runtime/blob/master/services/anvil/google/sheets.py

but this does not seem to correspond to what is actually running in the cloud - the line numbers do not correspond to what is in the traceback. I am therefore not sure whether the Clojure part has been modified or whether it corresponds to the open source version. How can one view the source of what is actually currently running in the cloud to debug this further?

I have not tried to deploy an instance on a server hosted by myself yet. I can try to do that if needed.

Code Sample:

In a server module, after the standard includes, paste:

@anvil.server.http_endpoint("/demobug")
def demobug():
    return repr(app_files.demo_bug["Sheet1"].fields)

Thanks for reporting - I’m able to reproduce this in basic python 3 (i.e. the free plan)

We’ll reply to this thread when we have an update.