I am writing a dataframe to a spreadsheet, I bold, change font, etc, but I can't change the format to be a number format:
from gspread_formatting import *
import gspread
from df2gspread import df2gspread as d2g
import pandas as pd
d2g.upload(data, sheet.id, 'test_name', clean=True, credentials=creds, col_names=True, row_names=False)
worksheet = sheet.worksheet('test_name')
worksheet.format("1", {
"backgroundColor": {
"red": 1.0,
"green": 1.0,
"blue": 1.0
},
"horizontalAlignment": "CENTER",
"textFormat": {
"fontSize": 12,
"bold": True
}})
worksheet.format("D:R", { # <--- this does not work
"numberFormat": {
"type": "NUMBER"}
})
set_row_height(worksheet, '1:100', 40)
set_column_width(worksheet, 'A:R', 125)
I am trying to follow this documentation. I also checked this answer.
But the format is still automatic and not a number.