Get postgres result into files

Hi all,

I am trying out this example, which retrieve postgres result and store into binary. However my binary file is empty. Taking a step back I try to check on my spreadsheet and binary but they are empty . Pls advise. Thanks

{
  "nodes": [
    {
      "name": "Start",
      "type": "n8n-nodes-base.start",
      "position": [
        250,
        300
      ],
      "parameters": {},
      "typeVersion": 1
    },
    {
      "name": "Run Query",
      "type": "n8n-nodes-base.postgres",
      "position": [
        450,
        450
      ],
      "parameters": {
        "query": "SELECT name, ean FROM product",
        "operation": "executeQuery"
      },
      "credentials": {
        "postgres": "postgres"
      },
      "typeVersion": 1
    },
    {
      "name": "Spreadsheet File",
      "type": "n8n-nodes-base.spreadsheetFile",
      "position": [
        600,
        450
      ],
      "parameters": {
        "operation": "toFile"
      },
      "typeVersion": 1
    },
    {
      "name": "Write Binary File",
      "type": "n8n-nodes-base.writeBinaryFile",
      "position": [
        750,
        450
      ],
      "parameters": {
        "fileName": "spreadsheet.xls"
      },
      "typeVersion": 1
    }
  ],
  "connections": {
    "Run Query": {
      "main": [
        [
          {
            "node": "Spreadsheet File",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Spreadsheet File": {
      "main": [
        [
          {
            "node": "Write Binary File",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}

Hey @lchunleo!

I tested it locally and it works for me. I don’t see the values in the Binary view of the nodes, but if I check the file that was written on my disk, it contains the values return by the Postgres node.

Thanks for replying. If I use
Select * from mytable query and see it in the gui and then link to a spreadsheet , will it automatically populate the spreadsheet? I think it suppose to be unless it some configuration issue. I attach my volume to the n8n docker .

Yes, it will automatically populate the spreadsheet! I don’t have much knowledge of Docker, but make sure that you can access the file outside Docker