sully sully - 1 year ago 184
Python Question

Smartsheet CHECKBOX Cells Always Returned as Empty

Whenever I retrieve a SmartSheet row and loop through the cells within it, all cells of type CHECKBOX always have a displayValue or value of Null, regardless of the status of the checkbox on the sheet. Has anyone else experienced this? (I am using their python sdk)

Answer Source

I believe you've found a bug with the Python SDK.

Kevin's answer correctly describes the behavior of the API itself, as I verified (using Postman), via the following request / response.

Get Row - Request:


Get Row - Response:

  "id": 863888846677892,
  "sheetId": 7359436428732292,
  "rowNumber": 1,
  "version": 88,
  "expanded": true,
  "accessLevel": "OWNER",
  "createdAt": "2016-07-06T22:21:58Z",
  "modifiedAt": "2016-07-27T01:50:46Z",
  "cells": [
      "columnId": 4509804229093252,
      "value": true

In the example Response above, the cell contains a Checkbox that is selected (value=true). So the API itself is behaving properly.

However, if I use the Smartsheet Python SDK to examine the exact same cell, the value attribute is being incorrectly set to null:

Python code:

import os
import smartsheet

smartsheet = smartsheet.Smartsheet()

# get sheet
sheet = smartsheet.Sheets.get_sheet(7359436428732292)

print('SheetId:\n' + str( + '\n')
print('RowId:\n' + str(sheet.rows[0].id) + '\n')
print('ColumnId (for the checkbox column):\n' + str(sheet.columns[0].id) + '\n')
print('Column object (for the checkbox column):\n' + str(sheet.columns[0]) + '\n')
print('Cell that contains a selected Checkbox:\n' + str(sheet.rows[0].cells[0]))

This code generates the following output:





ColumnId (for the checkbox column):


Column object (for the checkbox column):

{"index": 0, "locked": null, "systemColumnType": null, "autoNumberFormat": null, "symbol": null, "format": null, "primary": null, "options": [], "filter": null, "width": 75, "lockedForUser": null, "title": "CBcol", "hidden": null, "type": "CHECKBOX", "id": 4509804229093252, "tags": []}

Cell that contains a selected Checkbox:

{"format": null, "displayValue": null, "linksOutToCells": null, "columnType": null, "columnId": 4509804229093252, "hyperlink": null, "value": null, "conditionalFormat": null, "strict": true, "formula": null, "linkInFromCell": null}

So, unfortunately, it seems that the Python SDK isn't properly setting value for Checkbox columns (or for Symbol columns like "Star" that behave like checkbox columns). I'd suggest that you log this issue here, so that Smartsheet is aware and can address it. If you're able to fix the issue locally (i.e., by modifying your local copy of the smartsheet-python-sdk package), then you can also submit a pull request.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download