CSV Spreadsheet to Binary with empty result

I am trying to create a CSV file creating a Spreadsheet from several binary files, however the output of the file I’m creating is empty, has anyone encounter this issue?
(Note: when I read the file from the Spreadsheet I can see the correct output of all the csv files merged)

Here’s the flow:

{
  "name": "test",
  "nodes": [
    {
      "parameters": {},
      "name": "Start",
      "type": "n8n-nodes-base.start",
      "typeVersion": 1,
      "position": [
        250,
        300
      ]
    },
    {
      "parameters": {
        "operation": "toFile",
        "fileFormat": "csv",
        "options": {}
      },
      "name": "Spreadsheet File",
      "type": "n8n-nodes-base.spreadsheetFile",
      "typeVersion": 1,
      "position": [
        700,
        300
      ],
      "alwaysOutputData": false,
      "retryOnFail": false,
      "notesInFlow": false
    },
    {
      "parameters": {
        "fileSelector": "*.csv"
      },
      "name": "Read Binary Files",
      "type": "n8n-nodes-base.readBinaryFiles",
      "typeVersion": 1,
      "position": [
        480,
        300
      ]
    },
    {
      "parameters": {
        "fileName": "output.csv"
      },
      "name": "Write Binary File",
      "type": "n8n-nodes-base.writeBinaryFile",
      "typeVersion": 1,
      "position": [
        910,
        300
      ]
    }
  ],
  "connections": {
    "Start": {
      "main": [
        [
          {
            "node": "Read Binary Files",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Spreadsheet File": {
      "main": [
        [
          {
            "node": "Write Binary File",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Read Binary Files": {
      "main": [
        [
          {
            "node": "Spreadsheet File",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  },
  "active": false,
  "settings": {},
  "id": "1"
}

Welcome to the community @Sorvah!

What is happening currently is:

  1. You read all csv-files and the data of them gets saved in the binary-data
  2. You overwrite that binary data with empty data (as what the “Spreadsheet File” node is getting the data from the json-data, which is empty, and writes it into the binary one)
  3. You write that empty data multiple times (depending on how many input csv-files you had) to disk, overwriting each other (as the file-name is not dynamic)

What exactly do you have planned? Because currently, you are reading .csv files and also writing again .csv. If I know that I can build you an example workflow.

Thank you! It’s seems a great community with such a great tool n8n!

What I’m trying to achieve it’s a CSV merge, I think I understood what you meant, I have tried to read several binary files and add them to a Write Binary File, the file is created but it only creates a CSV with the last imported file. On the other hand, when I read the file with the Spreadsheet, the output showed all the data merged.

Thanks, really great to hear that you enjoy n8n!

The problem is probably that you then do not write the JSON data back to the binary data.

You can try the following:

{
  "nodes": [
    {
      "parameters": {
        "fileSelector": "./*.csv"
      },
      "name": "Read Binary Files",
      "type": "n8n-nodes-base.readBinaryFiles",
      "typeVersion": 1,
      "position": [
        450,
        300
      ]
    },
    {
      "parameters": {
        "options": {}
      },
      "name": "Spreadsheet File",
      "type": "n8n-nodes-base.spreadsheetFile",
      "typeVersion": 1,
      "position": [
        650,
        300
      ]
    },
    {
      "parameters": {
        "operation": "toFile",
        "fileFormat": "csv",
        "options": {}
      },
      "name": "Spreadsheet File1",
      "type": "n8n-nodes-base.spreadsheetFile",
      "typeVersion": 1,
      "position": [
        850,
        300
      ]
    },
    {
      "parameters": {
        "fileName": "combined.csv"
      },
      "name": "Write Binary File",
      "type": "n8n-nodes-base.writeBinaryFile",
      "typeVersion": 1,
      "position": [
        1050,
        300
      ]
    }
  ],
  "connections": {
    "Read Binary Files": {
      "main": [
        [
          {
            "node": "Spreadsheet File",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Spreadsheet File": {
      "main": [
        [
          {
            "node": "Spreadsheet File1",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Spreadsheet File1": {
      "main": [
        [
          {
            "node": "Write Binary File",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}

Awesome! This works fine, thank you so much!
I hope it can help other people if they struggle with the same problem.

Great, happy to hear!

Have fun!