This file contains 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('***') |
This file contains 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 next_available_row(sheet, cols=None): | |
cols = sorted([1, 2] if not isinstance(cols, list) or len(cols) != 2 else cols) | |
cols = sheet.get_values( | |
(1, cols[0]), (sheet.rows, cols[1]), | |
returnas='cells', include_tailing_empty_rows=True | |
) | |
return max([cell.address.index[0] for row in cols for cell in row if cell.value.strip()]) + 1 | |
gc = pygsheets.authorize() |