How to add a row with a CONTACT_LIST column using API (python)


I am trying to add a row to an existing sheet with a CONTACT_LIST column. As far as I can tell, I am following the syntax properly, but I am always getting a validation error in the response.

Can someone provide a sample request for this operation, using python.

I found this similar question, and it says it was answered, but no solution was provided.


  • jmyzk_cloudsmart_jp
    jmyzk_cloudsmart_jp ✭✭✭✭✭✭

    Hi @mortonj

    The Python code will add rows with a CONTACT_LIST column cell and a Multiple_CONTACT_LIST column cell if the sheet specified by sheet_id has such columns. (The code uses smartsheet-python-sdk.)

    pip install smartsheet-python-sdk
    import smartsheet
    access_token = 'your access token'
    smartsheet_client = smartsheet.Smartsheet(access_token)
    sheet_id = 1234567890123456
    sheet = smartsheet_client.Sheets.get_sheet(sheet_id)
    contact_list_column_id = next(( for column in sheet.columns if column.type == "CONTACT_LIST"), None)
    multiple_contacts_column_id = next(( for column in sheet.columns if column.version == 1), None)
    members = [
        {"name": "Jane Doe", "email": ""},
        {"name": "John Doe", "email": ""},
        {"name": "John Smith", "email": ""},
        {"name": "Jane Smith", "email": ""},
    rows_to_add = []
    multi_contacts = []
    for member in members:
        new_row = smartsheet.models.Row()
        if contact_list_column_id:
            contact_cell = smartsheet_client.models.Cell()
            contact_cell.column_id = contact_list_column_id
            member['objectType'] = 'CONTACT'
            contact_cell.object_value = member
        if multiple_contacts_column_id:
            multiple_contact_cell = smartsheet_client.models.Cell()
            multiple_contact_cell.column_id = multiple_contacts_column_id
            multiple_contact_cell.object_value = {"objectType": "MULTI_CONTACT", "values": multi_contacts}
        if contact_cell or multiple_contact_cell:
    if len(rows_to_add) > 0:
        # Add rows to sheet
        response = smartsheet_client.Sheets.add_rows(
            sheet_id,       # sheet_id