Search code examples
pythonsmartsheet-api

How to get Smartsheet published sheet's url?


I'd like to get url from a Smartsheet published sheet by Python.

Below is my code but it gives me error message.

 # Publish the sheet

sheetToPublish = smartsheet_client.Sheets.set_publish_status(

sheet.id,       # sheet_id

smartsheet.models.SheetPublish({

  'readOnlyFullEnabled': True

})

)

publish_sheet = smartsheet_client.Sheets.get_publish_status(

  sheet.id)       # sheet_id

print(publish_sheet.readOnlyFullUrl)

Here is the error message,

AttributeError: 'SheetPublish' object has no attribute 'readOnlyFullUrl'

Solution

  • When troubleshooting property names in situations like this, it's often helpful to look at the SDK source code on GitHub. In this case, the sheet_publish.py model that's defined in the SDK source code shows that the correct syntax for this property name is: read_only_full_url (not readOnlyFullUrl).

    sheet_publish.py property definition