With gspread, I'm trying to apply date formatting for a column, but it doesn't see to work. Here's a minimal example:
sh = gc.create("new")
ws = sh.get_worksheet(0)
ws.update("A1", "20/10/2023")
ws.format(
"A1",
{
"numberFormat": {
"pattern": "dd-mmm-yyyy",
"type": "DATE",
},
"textFormat": {"bold": True},
},
)
Looking at the results in Google Sheets, the text formatting is applied, but not the date format. Any idea?
Turns out a specific option needs to be add to the
updatemethod:value_input_option=ValueInputOption.user_enteredThe option is imported as:
from gspread.utils import ValueInputOption