Directory / File Tree List
Hello,
I'd like to get a file tree list of work spaces with folder names and the sheet names under the folders.
I believe this can be accomplished using the API and Python but I am completely inexperienced with any of this. Can anyone help me?
Answers
-
I have done this in both Python and Javascript
import smartsheet
smartSheetClient = smartsheet.Smartsheet(YOUR_API_TOKEN)
workspaces = smartSheetClient.Workspaces.get_workspace( workspace_id=YOUR_WORKSPACE_ID, load_all=True )
workspaces_dict = workspaces.to_dict()
print(json.dumps(workspaces_dict, indent=4))This provides you a Python Dict of the Workspace's content. This includes the Sheets, Reports, Dashboards nested in Folders. This Dict may provide what you need, or you may need to recurse it to build a tree that meets your needs.
Side Note: I often want to get an individual Sheet by its ID and know what it's Workspace/Folder path is. Unfortunately, none of the API's for individual sheets provide this information. Sheets only know what Workspace they are in, nothing about the folder structure. So you have to take the approach used above to recurse the entire Workspace to find the path of the individual sheet.
Categories
- All Categories
- 14 Welcome to the Community
- Customer Resources
- 64.5K Get Help
- 424 Global Discussions
- 136 Industry Talk
- 465 Announcements
- 4.8K Ideas & Feature Requests
- 143 Brandfolder
- 145 Just for fun
- 63 Community Job Board
- 465 Show & Tell
- 32 Member Spotlight
- 1 SmartStories
- 301 Events
- 39 Webinars
- 7.3K Forum Archives