Smartsheet-Python SDK: Workspace

Options

Hi everyone,

I am having trouble retrieving workspace from Smartsheet using Python. I installed smartsheet-python SDK already and have the token and headers for authorization so no problem there (can access sheets etc).

Here is the error: TypeError: get_workspace() missing 1 required positional argument: 'workspace_id'

Attached is my code. As I was typing get_workspace, it asks for an argument called self. I am unsure what to pass on that.

Also, Smartsheet API have a sample code on Python for getting workspaces which involves the code:

workspace = smartsheet_client.Workspaces.get_workspace(6621332407379844)    # workspace_id

But I get an error that smartsheet_client is not defined. How can I fix these?


Thank you for your help!

Answers

  • Genevieve P.
    Genevieve P. Employee Admin
    Options

    Hi @geluzi

    In the sample code, there is a set of numbers after "get_workspace" (6621332407379844) that is the Workspace ID:

    workspace = smartsheet_client.Workspaces.get_workspace(xxxxx)

    In your image, it looks like you have the words "workspace_id" in the code instead of replacing that with the actual ID numbers. You can use the List Workspace method to retrieve the numerical ID (see the Documentation, here) or you can identify this information in the UI by right-clicking on the Workspace and finding this number under "Properties".

    Let me know if that helped!

    Cheers,

    Genevieve