Overview
This node recursively builds a folder tree structure from Google Drive starting at a specified root folder. It fetches all files and folders under the root, including nested subfolders, and organizes them into a hierarchical JSON representation.
Common scenarios where this node is useful include:
- Visualizing or exporting the folder structure of a Google Drive account.
- Preparing data for backup or migration by understanding folder relationships.
- Automating workflows that require knowledge of folder contents and hierarchy.
For example, you can start from "My Drive" (using the root ID "root") or any specific folder ID to get a complete nested view of all contained files and folders.
Properties
| Name | Meaning |
|---|---|
| Root Folder ID | The starting point folder ID for building the tree. Use "root" for My Drive or specify a folder ID to start from that folder. |
Output
The output is a single item containing a JSON object representing the folder tree starting from the specified root folder.
The JSON structure includes:
id: The unique identifier of the file or folder.name: The name of the file or folder.mimeType: The MIME type indicating if the item is a folder (application/vnd.google-apps.folder) or a file.children: An array of child items (only present for folders), each with the same structure, representing nested files and folders.
If the specified root folder exists, the output JSON corresponds to that folder's subtree; otherwise, it defaults to a root node named "(root)".
No binary data is output by this node.
Dependencies
- Requires an OAuth2 API credential for Google Drive access.
- Uses Google Drive API v3 to list files and folders.
- Needs appropriate permissions/scopes to read files and folders in the user's Google Drive, including shared drives if applicable.
Troubleshooting
- Permission errors: Ensure the OAuth2 credential has sufficient scopes to read files and folders, including shared drives if needed.
- Invalid folder ID: If the provided root folder ID does not exist or is inaccessible, the node will return an empty or default root structure.
- API rate limits: For very large drives, the node may hit Google API rate limits. Consider adding delays or reducing page size if necessary.
- Trashed files: The node excludes trashed files and folders automatically.