How to get published sheet's readOnlyFullUrl

Roy YueRoy Yue ✭✭✭✭✭
01/25/21
Accepted

Hey Smartsheet Community!

I'd like to get Publish Link from a published sheet by Python.


Thanks


Roy


Best Answer

  • Roy YueRoy Yue ✭✭✭✭✭
    Accepted Answer

    @Sean Morgan


    Hey Sean, after I poste this question to Stackoverflow, I actually got an answer.

    "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)."


    It works like a charm.


    Thank you for your input.


    Roy

Answers

  • Hello @Roy Yue ,

    After reviewing our API Documentation, I was able to find the following that should help you obtain a Sheets Published URL:

    When using GET /sheets/{sheetId}/publish, it should provide:

    "readOnlyLiteEnabled": false,
        "readOnlyFullEnabled": true,
        "readWriteEnabled": false,
        "icalEnabled": false,
        "readOnlyFullAccessibleBy": "ALL",
        "readOnlyFullUrl": "https://publish.smartsheet.com/6d35fa6c99334d4892f9591cf6065"
    

    See more on this here: https://smartsheet-platform.github.io/api-docs/?python#publish-sheet

    Please let me know if you have any questions!

    Regards

    Sean

  • Roy YueRoy Yue ✭✭✭✭✭

    Hello @Sean Morgan ,


    thank you for your message, however when I try to get the url, it tells me sheetPublish object doesn't have "readOnlyFullUrl" attribute.


    My codes below,

    # Publish the sheet
    
    sheetToPublish = smartsheet_client.Sheets.set_publish_status(
    
    sheet.id,       # sheet_id
    
    smartsheet.models.SheetPublish({
    
      'readOnlyFullEnabled': True
    
    })
    
    )
    
    get_publish_sheet = smartsheet_client.Sheets.get_publish_status(
    
      sheet.id)       # sheet_id
    
    print(get_publish_sheet.readOnlyFullUrl)
    


    This is the error message.

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



    thanks a lot!


    Roy

  • Hello @Roy Yue ,

    After some testing with Python, I too was unable to get a published URL, and received the same error.

    With this, please can you reach out to Smartsheet Support Team here: https://www.smartsheet.com/contact

    Kindest Regards

    Sean

  • Roy YueRoy Yue ✭✭✭✭✭
    Accepted Answer

    @Sean Morgan


    Hey Sean, after I poste this question to Stackoverflow, I actually got an answer.

    "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)."


    It works like a charm.


    Thank you for your input.


    Roy

Sign In or Register to comment.