I am trying to format a cell to have multiple font colors using a function in Google Apps Script. I am unable to find any documentation on it. Also, using getFontColor
requests = [
object = {
"updateCells": {
"range": {
"sheetId": sheetId,
"startRowIndex":startRowIndex,
"endRowIndex": endRowIndex,
"startColumnIndex": startColumnIndex,
"endColumnIndex": endColumnIndex
}
"rows": [{
"values": [{
"textFormatRuns": [
{"format": {
"foregroundColor": {
"red": 0.0,
"green": 255.0,
"blue": 31.0
},
},"startIndex": 0
},
]
}
]
}]
"fields": "textFormatRuns(format)"
}
}
]
try:
result = service.spreadsheets().batchUpdate(spreadsheetId=internamiento_id,
body={'requests': requests}).execute()
print('{0} celdas actualizadas'.format(result.get('totalUpdatedCells')))
except Exception as e:
print(e)
json_salida["error"] = "Ocurrio un error "
return json_salida, 400