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.8K Get Help
- 434 Global Discussions
- 138 Industry Talk
- 470 Announcements
- 4.9K Ideas & Feature Requests
- 129 Brandfolder
- 148 Just for fun
- 65 Community Job Board
- 486 Show & Tell
- 33 Member Spotlight
- 2 SmartStories
- 300 Events
- 36 Webinars
- 7.3K Forum Archives