I am using gspread and I am looking for a proper way to changing column format by script. I have a column with time durations. I would like to change format of entire column to duration
. In Google UI I can mark entire column then click format, then number and set duration. Is it possible to do it by gspread/google sheets API?
EDIT
client = gspread.authorize(credentials)
try:
sheet = client.open(sys.argv[1]).sheet1
except (gspread.SpreadsheetNotFound, IndexError):
print("Spreadsheet not found")
sys.exit()
try:
tags = sheet.col_values(13)
tags.remove('Tags')
unique_tags = list(dict.fromkeys(tags))
except ValueError:
print("Your spreadsheet cannot be modified and should contain original
columns from toggle reports.")
sys.exit()
START_INDEX = 7
sheet.update_cell(6, 15, "SUM")
for tag in unique_tags:
sheet.update_cell(START_INDEX, 15, tag)
sheet.update_cell(START_INDEX, 16, "=SUMIF(M2:M; " + '"' + tag + '"' + ";
L2:L)")
START_INDEX += 1
sheet.update_cell(6, 16, "=SUM(P7:P15)")