Anyone who needs to recursively fetch all files from a specific Google Drive folder, including files inside all its nested (child) folders.
Ideal for automation builders, admins, and integrators who want to process, move, list, or report on all files in a complex folder tree.
⚙️ How it works / What it does
This workflow will:
Accept a Google Drive Folder ID as an input (from another workflow or trigger).
Recursively discover all child folders starting from the parent, no matter how many levels deep.
Collect all file IDs & names from every folder (parent + all descendants).
Return a clean list of all found files (with IDs and names) for further automation, downloading, or processing.
Key features:
💡 Works recursively (handles any depth of nested folders).
🏷️ Outputs file ID & file name for each discovered file.
🔄 Can be triggered by other workflows (great for modular automation).
🛠️ How to set up
1. Google Drive Credentials
Make sure you’ve set up a Google Drive OAuth2 credential in n8n.
Connect this credential to all Google Drive nodes in the workflow.
2. Parent Folder ID
Input the Google Drive folder ID you want to start from.
How to pass it:
If running standalone: update the When Executed by Another Workflow node with your folder ID.
If called from another workflow: pass the folder ID as an input named id.
3. Check Set Nodes
There are two Set nodes (Return parent and Return parent1) and one trigger (When Executed by Another Workflow) where you might want to update the hardcoded folder ID.
⚠️ Change these IDs to match your use case.
4. Run the Workflow
Start the workflow (or execute it via another workflow).
The result will be a flat list of files in all subfolders.
✅ Requirements
🟢 n8n instance
🟢 Google Drive OAuth2 credentials connected in n8n
🟢 A valid Google Drive folder ID to start from
🧑💻 How to customize
Return Extra Data:
Add fields in the “Search files” node options to return more Google Drive file metadata (e.g., size, webViewLink).
Filter by File Type:
Adjust the search query or add a filter node to only include certain file types (e.g., PDFs, Docs).
Change Output Format:
Edit the “Edit Fields” Set node to structure your output differently.
Integrate Further:
Add new nodes after the Loop to, for example, download, email, or sync files as needed.
🚨 Notes & Tips
Performance:
This workflow is optimized for up to hundreds of folders. For very large Drive accounts (thousands of folders/files), consider pagination or batching.