Skip to content Skip to sidebar Skip to footer

Unknown Name "update_sheet_properties"

I am using the google-client-api-python v4 and trying to update the properties of a sheet using the following code for sheet in result.get('sheets', ''): sheetId = (sheet.get('

Solution 1:

I found the mistake

firstly this should have been

"updateSheetProperties":{

instead of

"UpdateSheetProperties":{

Also I needed to have the following line

"fields":"gridProperties(rowCount, columnCount)"

The actual code would be

for sheet in result.get('sheets', ''):
        sheetId = (sheet.get("properties", {}).get("sheetId", 0))

        batch_request = {
            "requests": [
                {
                    "updateSheetProperties": {
                        "properties": {
                            "sheetId": sheetId,
                            "gridProperties": {
                                "rowCount": 2000,
                                "columnCount": 4,
                            }
                        },
                        "fields" : "gridProperties(rowCount, columnCount)"
                    }
                }
            ],
        }
        result = service.spreadsheets().batchUpdate(spreadsheetId=spreadsheetId, body=batch_request).execute()

Jay

Post a Comment for "Unknown Name "update_sheet_properties""