Refactor a workflow that creates google drive folders if they do not exist

Describe the problem/error/question

Hi folks,

When building this workflow, I faced some difficulties:

  • I need to check that a folder exists before creating it, this means that the node that searches for a folder may or may not return an item => I have to enable “Always output data” to keep the workflow going if no item is returned
  • The first part of the workflow creates a “group folder” for multiple people, fine.
  • In the second part, I want to loop over the list of group participants to add subfolders, and this is where it becomes tricky.
  • Normally a “split” shouldn’'t require a loop afterwards, but it doesn’t seem to work as expected in presence of the “always output data” setting on the second node that search if the person’s folder already exists
  • Also, I needed to have a “merge” node to be able to retrieve the id of the just created group folder (that is the same for all participants, so the merge just repeats the same data multiple times), otherwise I fail to be able to use it in the final node

Can I improve this workflow somehow?

What is the error message (if any)?

Workflows works ok but feels complex

Please share your workflow

Share the output returned by the last node

Information on your n8n setup

  • n8n version:
  • Database (default: SQLite):
  • n8n EXECUTIONS_PROCESS setting (default: own, main):
  • Running n8n via (Docker, npm, n8n cloud, desktop app):
  • Operating system:

Hi @eric-burel , good day!
I would simplify this by using an IF node after the folder lookup. if the folder exists, reuse its ID; otherwise create it. Then normalize both branches to output the same folderId field before continuing.

Hi Tamy, I think that’s how it’s implemented, the part that feels messy is the loop + the need for a merge node to mix split data and global config into each item

Ah yes, I see what you mean now. In that case, I would probably avoid the Merge entirely by attaching the session_folder_id to each participant item before the split, so every item already carries both the participant name and the shared folder ID through the loop.

That usually makes the flow much easier to reason about because the loop becomes fully self-contained and you no longer need to recombine “global” workflow state afterward.