What does smartsheet.models.duration.Duration().elapsed do ?

edited 12/09/19 in API & Developers


My question is in the title. I've been trying to play with that but it does not seem to have any impact on duration behaviour, whether it is in the duration column or as a lag for a predecessor.

Thank you


  • Paul Newcome
    Paul Newcome ✭✭✭✭✭✭

    Elapsed duration simply ignores non-working days. If the start day is Monday and you just have 7d for your duration, it will display the finish date as next Tuesday (7 working days). If your duration is e7d, then it will include the non-working days of Saturday and Sunday, and your finish date would be displayed as Sunday. (Assuming you have it set as Mon - Fri as working days)

  • dAVE Inden
    dAVE Inden Employee

    Paul's comment above is correct for the behavior of elapsed time in your sheets. As for what you are seeing in the Python SDK, that is just for the purposes of JSON serialization. When you have elapsed time values in durations on your sheet you will see an elapsed attribute on the Duration object and that method sets the boolean value as needed when that attribute is present. There isn't any ability to set whether or not a duration is elapsed time via that attribute. instead you would enter in a duration value like "e3d" to make the duration behave as elapsed time. Note, you only see this in the Duration object if you include objectValue in your GET Sheet request. An example of including objectValue would look like this:

    sheet = smar_client.Sheets.get_sheet(<SHEET_ID>, ['objectValue'])

  • Ooh I see, thank you !

  • Does it mean I can't change that from the API when using the objectValue field ? It's far more consistent and tractable to use the objectValue because it refers the predecessors by row id and not by row number.

    But the objectValue field requires me to put a duration object for the lag I want. Sadly it does not seem like I can pass a string value with the 'e' at the beginning to force the elapsed time mode. I only have access to the field elapsed_time of the duration object. But as you said, it doesn't work to update the rows from the API.

    Any way I can do this ?

  • dAVE Inden
    dAVE Inden Employee

    You can update a row to give elapsed time in the Duration column. Here is an adjusted example of the update_rows method updating a Duration column to an elapsed time using object_value:

    # Assuming you created a client with the SDK named smar_client

    # Build object value

    new_object_value = smar_client.models.Duration()

    new_object_value.days = 3

    new_object_value.elapsed = True


    # Build new cell value

    new_cell = smar_client.models.Cell()

    new_cell.column_id =<COLUMN_ID>

    new_cell.object_value = new_object_value


    # Build the row to update

    new_row = smar_client.models.Row()

    new_row.id = <ROW_ID>



    # Update rows

    updated_row = smar_client.Sheets.update_rows(



  • I have literally no idea what I was previously doing wrong then. Now it works >< Thank you !

  • dAVE Inden
    dAVE Inden Employee

    Glad to hear it's working!