Skip to content

A wrapper for the smartsheet-python-sdk that monkey patches new & improved functionality.

License

Notifications You must be signed in to change notification settings

davocarli/smartools

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Smartools

smartools is a wrapper around the official smartsheet-python-sdk. It monkey patches several classes to add new functionality, and also implements some completely new classes/models as well.

The decision was made to monkey patch the smartsheet sdk rather than fork it because by extending the existing package, this package can be updated independently of the original sdk and sis not dependent on a specific version.

Installation

The package is available to install from PyPi using:

pip install smartools

Once installed it can be imported with import smartools or can more "authentically" replace the official sdk by using import smartools as smartsheet

Usage

In general, usage of smartools is identical to the standard SDK. All original functionality is supported so any existing code should not need to be updated. For more information, see the Smartsheet API Docs.

Extended/Improved Functionality

Comparison of sharing permissions

smartools allows you to easily compare sharing permissions using the standard >, <, >=, >=, == methods. This can be useful when writing code that will evaluate whether a user has high enough permissions to perform an action. Smartools also has added support for the COMMENTER permission level. It also includes a new permission level, "UNSHARED" that can be used for comparisons. That permission level simply indicates that somethng isn't shared to you, and is only ever returned when using a get_access_level method.

sheet = smartsheet_client.Sheets.get_sheet(sheet_id)

sheet.access_level                 # EDITOR_SHARE
sheet.access_level >= 'EDITOR'     # True
sheet.access_level == 'OWNER'      # False
sheet.access_level > 'EDITOR'      # True
sheet.access_level != 'UNSHARED'   # True - This is a new "permission level" exclusive to smartools

Easily Retrieve Child Rows

Rows now allow you to get their child rows by accessing row.children.

sheet = smartsheet_client.Sheets.get_sheet(sheet_id)

sheet.rows[0].children  # Will return a list of child rows

Indexing sheets/reports

Some of the greatest improvements to smartools are in the indexing of lists. Rows, Columns, and Cells can now be indexed using strings, as explained below.

Columns