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
- 66.5K Get Help
- 433 Global Discussions
- 152 Industry Talk
- 494 Announcements
- 5.3K Ideas & Feature Requests
- 85 Brandfolder
- 155 Just for fun
- 77 Community Job Board
- 506 Show & Tell
- 34 Member Spotlight
- 2 SmartStories
- 307 Events
- 37 Webinars
- 7.3K Forum Archives