'Not able to change format of cells to "NUMBER" or "SCIENTIFIC" using google sheets API
I am using python Google Sheet APIs(Python) to change formats of a few columns from text to either scientific or number. However, when I run the below code, it finishes without any errors, but the columns specified in the range are still text. Am I missing something?
request = [{
"repeatCell": {
"range": {
"sheetId": 0,
"startRowIndex": 1,
"endRowIndex": 100,
"startColumnIndex": 5,
"endColumnIndex": 16
},
"cell": {
"userEnteredFormat": {
"numberFormat": {
"type": "SCIENTIFIC",
"pattern": "0.00e+00"
}
}
},
"fields": "userEnteredFormat"
}
},
{
"repeatCell": {
"range": {
"sheetId": 0,
"startRowIndex": 1,
"endRowIndex": 100,
"startColumnIndex": 3,
"endColumnIndex": 4
},
"cell": {
"userEnteredFormat": {
"numberFormat": {
"type": "NUMBER",
"pattern": "#,##0.0000"
}
}
},
"fields": "userEnteredFormat"
}
}]
body = {
'requests': request
}
response = sheet_service.spreadsheets() \
.batchUpdate(spreadsheetId=sumSheetId, body=body).execute()
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
