gspread icon indicating copy to clipboard operation
gspread copied to clipboard

`update_cells` response values in input order

Open xoiga123 opened this issue 6 months ago • 3 comments

from gspread import Cell

cells = [
    Cell(row=1, col=1, value="A"),
    Cell(row=2, col=1, value="C"),
    Cell(row=1, col=2, value="B"),
]
result = ws.update_cells(cells, include_values_in_response=True)
print(result["updatedData"]["values"])
# ['A', 'C', 'B']

The original response would be

# [['A', 'B'], ['C']]

which wouldn't be intuitive when the user is already using a higher-level wrapper like update_cells, they passed a list of cells in (order may matter) and now they get a rect of cells back.

xoiga123 avatar Aug 16 '25 07:08 xoiga123

hi ! thanks for the PR ! sorry about the annoying linting hehe…

I will look at this properly in the coming time, but from a glance: is this a breaking change? can we add a test to test the behavour?

alifeee avatar Aug 23 '25 00:08 alifeee

@alifeee Hey sorry for the late reply, life can be a bother sometimes.

is this a breaking change?

No, this adds a flag include_values_in_response which defaults to None to Worksheet.update_values, so all previous code that didn't use it will be fine.

can we add a test to test the behavour?

Yeah I added test_update_cells_response_values, thanks for the reminder.

Tbh I didn't know there was a contributing guide because I only skimmed the readme, wouldn't it make more sense to move CODE_OF_CONDUCT.md and CONTRIBUTING.md outside of .github folder? I think most repos are structured that way, and I got conditioned into thinking we don't have a guide.

xoiga123 avatar Oct 12 '25 04:10 xoiga123

sorry, I do not have much time to review PRs right now. I hope that is okay :] — I am discussing gspread maintenance with @lavigne958.

alifeee avatar Oct 14 '25 12:10 alifeee