Python SDK update_column syntax


Using the python SDK I am attempting to update the options list in a "Pick List" column type but can't seem to get the syntax correct. I keep getting the error 1008 Unable to parse request.

My code is: ss.Sheets.update_column(4065220*********, 5852349******, {"type": "PICKLIST", "options": ["a", "b", "c", "d", "e"]}

error msg: {"response": {"statusCode": 400, "reason": "Bad Request", "content": {"errorCode": 1008, "message": "Unable to parse request.", "refId": "8293a119***"}}}

{"result": {"code": 1008, "errorCode": 1008, "message": "Unable to parse request.", "name": "ApiError", "recommendation": "Do not retry without fixing the problem. ", "refId": "8293a119***", "shouldRetry": false, "statusCode": 400}}

I've confirmed my sheet_id and column_id are correct by calling get_column. I can successfully send an API put request with postman but this project calls for using the Python SDK.

The SDK documentation gives the syntax as "update_column(sheet_id,column_id,column_obj)" but doesn't give (nor could I find anywhere) the syntax for column_obj

My question is: What is the correct syntax for the column_obj in sheet.sheets.udpate_column() to update the options property of a PICKLIST column?


  • KenR
    KenR ✭✭

    I gave up and just wrote my own python function to upload the new options:

    #variables needed include: url, sheet_id, column_id, column_type, OptionStr, token

    #OptionStr was retrieved from my python dictionary. In my case the dictionary key (for key in dictionary: OptionStr = dictionary[key])

    #column_type in my case will always be 'PICKLIST'

    def update_ColumnOptionsRequest(sheet_id, column_id, column_type, OptionStr):

        url = ''+sheet_id+'//columns//'+column_id

        body = json.dumps({"type": column_type, "options": OptionStr}) # column type is required when changing options

        headers = {

            'Content-Type': 'application/json',

            'Authorization': 'Bearer '+ token


        response = requests.request("PUT", url, headers=headers, data=body)

        return response