0
votes

I am trying to add a new row to an existing sheet with date columns. Some of the cells in the new row hyperlink to other sheets, this works fine. But there are other cells that I want to link_in_to from other sheets. I keep getting an "attributes are not allowed for this operation" error.

there was a comment from an old smartsheet community post indicating that cell links don't work in the 1.1 API. But we are well past that, and the 2.0 documentation implies that it should be possible.

Has anyone else seen this or solved it?

row_a.cells.append({
    'column_id': status_columns['Exp Start'],
    'value': None,
    'linkInFromCell': {
        'columnID': project_columns['Start'],
        'rowID': project_rows[1],
        'sheetID': map_of_sheets[this_project]},
})
1

1 Answers

0
votes

The value property must be set to an ExplicitNull (so that it is serialized as null in the JSON body), like this:

        cell = smart.models.Cell()
        cell.column_id = col_id
        cell.link_in_from_cell = cell_link
        cell.value = smart.models.ExplicitNull()

        row = smart.models.Row()
        row.id = added_row.id
        row.cells.append(cell)

        action = smart.Sheets.update_rows(sheet.id, [row])

Check out test_regression.py in the tests/integration folder, test case test_link_in_from_cell shows the technique.