nithinmurali / pygsheets

Google Sheets Python API v4
https://pygsheets.readthedocs.io/en/latest
Other
1.51k stars 220 forks source link

cell().get_json() not working with templates #543

Closed LuisDeMarcos closed 2 years ago

LuisDeMarcos commented 2 years ago

When selecting a cell from a worksheet created from a template, the get_json() function returns the json as if it was a blank cell.

Example: Cell A1 contains red background with bold text.

c = wks.cell("A1") print(c.get_json()) # Doesn't show that the background is red nor the text is bold.

However, if we do the following: c = wks.cell("A1") c.color = (255,0,0,1) # Doesn't modify the cell properties as it was already red c.get_json() # Returns the json correctly showing that the background is red and the text is bold.

Do you know what could be causing this issue?

Thank you.

nithinmurali commented 2 years ago

By default wks.cell() wont fetch complex properties of cell unless you access one of them.

You can check this by c.simple

you can call c.refresh() or c.fetch() or just c.color and then try get_json() . see docs.