Skip to content
This repository was archived by the owner on Jan 9, 2023. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion smartsheet/home.py
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ def create_sheet_from_template(self, sheet_obj, include=None):
sheet_obj (Sheet): Sheet object.
include (list[str]): A list of optional elements
to include from the source Template. Valid list values:
data, attachments, discussions, cellLinks, forms.
attachments, cellLinks, data, discussions, forms, rules and ruleRecipients.

Returns:
Result
Expand Down
9 changes: 9 additions & 0 deletions smartsheet/models/column.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ def __init__(self, props=None, base_obj=None):
self._contact_options = TypedList(Contact)
self._description = String()
self._format_ = String()
self._formula = String()
self._hidden = Boolean()
self._id_ = Number()
self._index = Number()
Expand Down Expand Up @@ -114,6 +115,14 @@ def format_(self):
def format_(self, value):
self._format_.value = value

@property
def formula(self):
return self._formula.value

@formula.setter
def formula(self, value):
self._formula.value = value

@property
def hidden(self):
return self._hidden.value
Expand Down
9 changes: 8 additions & 1 deletion smartsheet/sheets.py
Original file line number Diff line number Diff line change
Expand Up @@ -470,7 +470,9 @@ def get_share(self, sheet_id, share_id):
return response

def get_sheet(self, sheet_id, include=None, exclude=None, row_ids=None,
row_numbers=None, column_ids=None, page_size=None, page=None, if_version_after=None, level=None):
row_numbers=None, column_ids=None, page_size=None, page=None,
if_version_after=None, level=None, rows_modified_since=None,
filter_id=None):
"""Get the specified Sheet.

Get the specified Sheet. Returns the Sheet, including Rows,
Expand Down Expand Up @@ -500,6 +502,9 @@ def get_sheet(self, sheet_id, include=None, exclude=None, row_ids=None,
page (int): Which page to return.
if_version_after (int): only fetch Sheet if more recent version
available.
rows_modified_since: Date should be in ISO-8601 format, for example, rowsModifiedSince=2020-01-30T13:25:32-07:00.
filter_id (int): Applies the given filter (if accessible by the calling user)
and marks the affected rows as "filteredOut": true

Returns:
Sheet
Expand All @@ -516,6 +521,8 @@ def get_sheet(self, sheet_id, include=None, exclude=None, row_ids=None,
_op['query_params']['page'] = page
_op['query_params']['ifVersionAfter'] = if_version_after
_op['query_params']['level'] = level
_op['query_params']['rowsModifiedSince'] = rows_modified_since
_op['query_params']['filterId'] = filter_id

expected = 'Sheet'
prepped_request = self._base.prepare_request(_op)
Expand Down
18 changes: 18 additions & 0 deletions tests/integration/test_columns.py
Original file line number Diff line number Diff line change
Expand Up @@ -71,3 +71,21 @@ def test_delete_column(self, smart_setup):
col.id
)
assert action.message == 'SUCCESS'

def test_column_formulas(self, smart_setup):
smart = smart_setup['smart']
action = smart_setup['sheet'].add_columns({
'title': 'Column Formula',
'type': 'DATE',
'index': 1,
'formula': '=TODAY()'
})
cols = action.result
assert action.message == 'SUCCESS'
assert cols[0].formula is not None

action = smart.Sheets.update_column(smart_setup['sheet'].id, cols[0].id,
{'formula': ''})
col = action.result
assert action.message == 'SUCCESS'
assert col.formula is None