'How to update a row using the Gspread python module

Hello basicaly i have this data, compose of name, project, reason and timestamps here's below is the structure

['John Doe', 'Hollywood', 'Good-time', '2022-05-17 15:25:45']

and on the documentation, it only shows how to update an individual cell, but i wanted to update entire row. Thanks in advance



Solution 1:[1]

You have 2 ways to update the content of you spreadsheet using gspread.

  1. Using update method It will update the specified range with values you provide. Example: updating cells A2 to B2
worksheet.update("A2:B2", [[42], [43]])
  1. Using update_cells You create a list of Cell object with each value for each cell then update the cells

Examples: updating cells A2 to B2

C1 = Cell(2, 1, 42)
C2 = Cell(2, 2, 43)
worksheet.update_cells([C1, C2])

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Lavigne958