Import/export in separate file - Import problem : File does not seem to contain workflows

There is a problem to reimport one workflow (separate file), I have this message:
File does not seem to contain workflows.

All days, I backup workflow in separate file to save it without problem.
The problem is the reimport specific workflow.
To fix it I I need to update the json file like this:

 // Worflow data

I add the [ ] in the file and then import separate file is OK.

Can you fix it with add [ ] when export in separate file ?


Short answer:
Looks for me like you use the wrong settings. If you export the workflows in separate files (so using the --separate parameter) you also have to import them again with the --separate option.

Long answer:
If you exported your workflows with --separate it saves each workflow in one file with just { // Workflow data}.
If you export without it, it saves all workflows in one single file and so in an array (so [{ // Workflow data}] gets added around it).

With importing it is exactly the same.
If you import with --separate it does expect multiple files, one file per workflow with just { // Workflow data}.
If you import without it, it expects them all in one single file and so an array with [{ // Workflow data}].

Hope that helps and makes sense.

You can find the documentation here:

Hi. Thanks for your answer but I want import only one workflow, not all with --separate

All theses commands return an error:

n8n import:workflow /data/backups/wf/4.json
n8n import:workflow --input=/data/backups/wf/4.json
n8n import:workflow --separate --input=/data/backups/wf/4.json

To import only one file I need update 4.json and add [ ] in the file and then import with:

n8n import:workflow  --input /data/backups/wf/4.json

This method works like that

1 Like

Hi @vdeapps_vdeapps

Perfect, either you add the [] enclosing the single file and import it or you move the one workflow file you wish to importo to a separate folder and you can then use --separate --input=path/to/separate/folder

The way it is built under the hood is, just for clarification:

  • If you use --separate then you must pass a folder to --input and we scan for all *.json files inside this folder, looking for 1 workflow per file to import
  • If you don’t use --separate then you must provide a single file via --input and it must be an array of workflows (i.e. with []).

Glad it’s all working.