Created
June 20, 2023 12:00
-
-
Save maksam07/a517ca31352e7688c896c2597f2ca4da to your computer and use it in GitHub Desktop.
pygsheets 2.0.6. Updating multiple cells with a single request. Data in dictionary format "address: value"
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def update_values_batch_dict(ws, data): | |
keys = list(data.keys()) | |
values = [[[val]] for val in data.values()] | |
return ws.update_values_batch(keys, values) | |
gc = pygsheets.authorize() | |
sh = gc.open_by_key('***') | |
ws = sh.worksheet_by_title('***') | |
cells = { | |
'A1': '1', | |
'A2': '2', | |
'A3': '3', | |
'B1': '11', | |
'B2': '22', | |
'B3': '33', | |
} | |
update_values_batch_dict(ws, cells) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment