[Fixed] When writing to a specific cell in sheet 2, Google Sheets writes it on sheet 1!

What I’m trying to do:

Writing to a specific cell in sheet 2, Google Sheets writes it on sheet 1!
when click
image
Google Sheets writes True on sheet 1 instead of sheet 2
What I’ve tried and what’s not working:
here is the image before:
Screen Shot 2022-08-18 at 1.15.27 PM
and here is the image after (it writes always in sheet 1):
Screen Shot 2022-08-18 at 1.31.11 PM

Code Sample:

client:
def primary_color_1_click(self, **event_args):
    anvil.server.call('update',2,2,"True")

server:
@anvil.server.callable
def update(rid,cid,v):
   # print(rid,cid)
    lib = app_files.untitled_spreadsheet
    worksheet2 = lib[1]
    
    cell = worksheet2.get_cell(rid,cid)
    print(cell)
    cell.value = v
   #cell.input_value = v
    
# this is a formatted code snippet.
# paste your code between ``` 

Clone link:
you need to create google sheet and use google API
https://anvil.works/build#clone:FQUEDQRCYW5NNZ3U=XNJSRYBVMZMQAIV2PJPNPVI3
share a copy of your app

I don’t use Google Sheets. But library authors often disagree about whether to number lists from 0 or from 1. Is it possible that `lib[1]’ refers to Sheet 1?

I had tried that, but it gave me index error: list index out of range.
I used lib[1] to get data from sheet2, but when it comes to writing for some reason it insists to write in sheet1 :thinking:

Sounds like a bug to me. We’ll get that fixed and update this thread when that’s done.

1 Like

This should now be fixed

2 Likes