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
- Smartsheet Customer Resources
- 64.1K Get Help
- 412 Global Discussions
- 221 Industry Talk
- 459 Announcements
- 4.8K Ideas & Feature Requests
- 143 Brandfolder
- 141 Just for fun
- 58 Community Job Board
- 461 Show & Tell
- 31 Member Spotlight
- 1 SmartStories
- 299 Events
- 38 Webinars
- 7.3K Forum Archives