I have an existing workflow that is already mostly working. Current behavior: I drop a file into Folder 1. The workflow processes that file. The processed/new file goes to Folder 2. The original file gets moved to Folder 3. The problem: Right now, this only works properly if I place one file at a time into Folder 1. If I drop 2, 3, or more files into Folder 1 at the same time, the workflow tries to process them all simultaneously, which causes the workflow to take the 2 or 3 or however mnay files and combines the results of all the files into one big file. What I want: I want to be able to drop multiple files into Folder 1 at once. The workflow must not process them all in parallel Instead, it should treat Folder 1 like a queue and process the files strictly one at a time, in sequence. Only after one file has fully completed the workflow should the next file begin processing. PLease can anybody help me with this?
What is the error message (if any)?
Please share your workflow
(Select the nodes on your canvas and use the keyboard shortcuts CMD+C/CTRL+C and CMD+V/CTRL+V to copy and paste the workflow.)
Share the output returned by the last node
Information on your n8n setup
n8n version: latest
Running n8n via (self hosted using docker, easypanel, ngrok and hetzner.
Hello @Joey_While ,This is a classic queue problem in n8n and there are two clean ways to solve it.
The easiest solution is to use a Execution Queue approach:
Go to your workflow settings and turn on the option that says Execute in same process or limit concurrency. In n8n you can set the concurrency limit of a workflow to 1. This means even if 3 files trigger the workflow at the same time, n8n will queue the executions and run them one by one automatically.
To do this, open your workflow, click the three dots or settings icon, and look for Execution order"or Concurrent executions and set it to 1.
This alone should solve your problem without changing anything in your existing workflow.
If that option is not available in your version, the manual approach is:
Instead of using Google Drive Trigger directly, set up a scheduled trigger that runs every few minutes. The scheduled workflow will scan Folder 1, pick only the first file it finds, process it completely, then stop. Next time it runs it picks the next file. This guarantees one file at a time.
hey @moosa thanks for your reply. i don’t have the option in my n8n to change the Execution order"or Concurrent executions. So to do it manually must i just replace my trigger node with a schedule node and keep everything else the same? Please advise
Yes exactly, just replace your Google Drive Trigger with a Schedule Trigger and keep everything else the same.
But you need to add two small steps at the beginning:
After the Schedule Trigger, add a Google Drive node set to List Files and point it to Folder 1. This will fetch all the files sitting in that folder.
Then after that, add a Limit node and set it to 1. This makes sure only the first file gets picked up and processed, ignoring the rest for now.
Then connect it to your existing Download CSV node and everything else stays exactly as it is.
So your new flow start will look like this:
Schedule Trigger → List Files in Folder 1 → Limit to 1 file → Download CSV → rest of your existing workflow
Each time the schedule runs it will grab one file, process it fully, move it to Folder 3, and then on the next run it will pick the next file. This way files are always processed one at a time in sequence.
In your Search files and folders node, the “What to Search” field is set to Folders but it should be set to Files. Right now it is searching for folders inside your inbox folder instead of the actual CSV files.
Change that to Files and everything else looks correct. The Limit node is already set to 1 which is perfect.
After fixing that, test it by dropping a couple of files into Folder 1 and running the workflow manually to confirm it only picks and processes one file at a time.
The problem is clear from the screenshot. You changed What to Search to Files which is correct, but you removed the Folder filter. Also the Search Query is still set to the folder name “01_inbox (drop CSVs here)” which is wrong because you are now searching for a file with that name and obviously no file has that name.
Fix it like this:
Clear the Search Query field and leave it empty so it returns all files.
Then click Add Filter and add the Folder filter back, pointing it to your 01_inbox folder like it was before.
So it should be:
Search Query: empty
What to Search: Files
Filter > Folder: 01_inbox (drop CSVs here)
This way it will search inside that folder and return all CSV files sitting in it. Then the Limit node picks just the first one and the rest of the workflow runs normally.
From the screenshots, it looks like the next step is to focus just on that Google Drive search node first. Right now it isn’t returning anything, so the workflow doesn’t really have anything to work with after that point. I’d check whether the search term exactly matches what’s actually in Drive, try a simpler search value first, and make sure the previous node is passing the value you expect into that field. If it’s valid for the workflow to continue even when nothing is found, turning on Always Output Data for that node can also help while testing.
Ok @moosa so i made the changes and tried to run it again but now it gives this error. also please confirm if the rest of the workflow execution looks right or is working.
Good news first @Joey_While , the rest of the workflow execution looks correct. The data is flowing through all the nodes properly so the logic is working fine.
The error is in the JSON Verified CSV node. The file name expression is still referencing the old node called Google Drive Trigger (Inbox) which no longer exists because you replaced it with the Schedule Trigger and Search files setup.
To fix it, open the JSON Verified CSV node and find the File Name field. You will see an expression that says something like:
$node["Google Drive Trigger (Inbox)"].json.name
Replace that old node reference with the new one pointing to your Search files and folders node like this:
This tells it to grab the file name from the Search node instead of the old trigger that no longer exists. Save it and run again and it should work fine.
Good news first @Joey_While , the rest of the workflow execution looks correct. The data is flowing through all the nodes properly so the logic is working fine.
The error is in the JSON Verified CSV node. The file name expression is still referencing the old node called Google Drive Trigger (Inbox) which no longer exists because you replaced it with the Schedule Trigger and Search files setup.
To fix it, open the JSON Verified CSV node and find the File Name field. You will see an expression that says something like:
$node["Google Drive Trigger (Inbox)"].json.name
Replace that old node reference with the new one pointing to your Search files and folders node like this:
This tells it to grab the file name from the Search node instead of the old trigger that no longer exists. Save it and run again and it should work fine.
@moosa One more thing what do you reccomend i set the interval on the schedule node at the moment it is 6 seconds which is probbaly to short but yeah i just made it that as i wasn’t sure what it should be. Please let me know what you think it should be
For the interval it really depends on how time sensitive your processing is. Here is what I would recommend:
If files do not need to be processed urgently then every 5 minutes is a solid choice. It is not too frequent and gives each file enough time to fully finish before the next run.
If files need to be processed quickly then every 1 to 2 minutes is fine.
6 seconds is way too short. If a file takes longer than 6 seconds to process, the next run will kick in before the previous one finishes which could cause the same overlap problem you had before.
I would start with 5 minutes and see how it feels in real usage. You can always lower it later if needed.
Hey @moosa the problem is some files are larger and some are smaller so i can never know for sure how long the workflow will take before it’s procssed the file. Any suggestion on what i should do?