AutomationFlowsData & Sheets › Export PostgreSQL to CSV

Export PostgreSQL to CSV

Original n8n title: Postgresql Export to CSV

PostgreSQL export to CSV. Uses manualTrigger, spreadsheetFile, postgres. Event-driven trigger; 4 nodes.

Event trigger★★☆☆☆ complexity4 nodesSpreadsheet FilePostgres
Data & Sheets Trigger: Event Nodes: 4 Complexity: ★★☆☆☆ Added:

The workflow JSON

Copy or download the full n8n JSON below. Paste it into a new n8n workflow, add your credentials, activate. Full import guide →

Download .json
{
  "id": "39",
  "name": "PostgreSQL export to CSV",
  "tags": [],
  "nodes": [
    {
      "id": "ed94b34e-9ae6-4925-b292-b64a7e0bd602",
      "name": "When clicking \"Execute Workflow\"",
      "type": "n8n-nodes-base.manualTrigger",
      "position": [
        660,
        420
      ],
      "parameters": {},
      "typeVersion": 1
    },
    {
      "id": "f5ada70d-c186-4d28-a64b-3847e2625c8d",
      "name": "Spreadsheet File",
      "type": "n8n-nodes-base.spreadsheetFile",
      "position": [
        1260,
        420
      ],
      "parameters": {
        "options": {},
        "operation": "toFile",
        "fileFormat": "csv"
      },
      "typeVersion": 1
    },
    {
      "id": "4e06ae2b-ef42-4ef4-b7b2-56eb70738a03",
      "name": "TableName",
      "type": "n8n-nodes-base.set",
      "position": [
        840,
        420
      ],
      "parameters": {
        "values": {
          "string": [
            {
              "name": "TableName",
              "value": "booksRead"
            }
          ]
        },
        "options": {}
      },
      "typeVersion": 1
    },
    {
      "id": "457ed549-507d-422a-bd14-1736252bd2e9",
      "name": "Postgres",
      "type": "n8n-nodes-base.postgres",
      "position": [
        1060,
        420
      ],
      "parameters": {
        "query": "=SELECT * FROM {{ $json[\"TableName\"] }}",
        "operation": "executeQuery",
        "additionalFields": {}
      },
      "credentials": {
        "postgres": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 1
    }
  ],
  "active": false,
  "settings": {},
  "versionId": "586e2a98-69a0-4a40-8c92-89380a7cca73",
  "connections": {
    "Postgres": {
      "main": [
        [
          {
            "node": "Spreadsheet File",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "TableName": {
      "main": [
        [
          {
            "node": "Postgres",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "When clicking \"Execute Workflow\"": {
      "main": [
        [
          {
            "node": "TableName",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}

Credentials you'll need

Each integration node will prompt for credentials when you import. We strip credential IDs before publishing — you'll add your own.

Pro

For the full experience including quality scoring and batch install features for each workflow upgrade to Pro

About this workflow

PostgreSQL export to CSV. Uses manualTrigger, spreadsheetFile, postgres. Event-driven trigger; 4 nodes.

Source: https://github.com/Zie619/n8n-workflows — original creator credit. Request a take-down →

More Data & Sheets workflows → · Browse all categories →

Related workflows

Workflows that share integrations, category, or trigger type with this one. All free to copy and import.

Data & Sheets

Convert Postgresql Table To Csv. Uses manualTrigger, spreadsheetFile, postgres. Event-driven trigger; 4 nodes.

Spreadsheet File, Postgres
Data & Sheets

How to automatically import CSV files into postgres. Uses manualTrigger, readBinaryFile, spreadsheetFile, postgres. Event-driven trigger; 4 nodes.

Read Binary File, Spreadsheet File, Postgres
Data & Sheets

-- Disclaimer: This template is mainly made for self-hosted users who can reach CSV files in their file system. For Cloud users, just replace the first few nodes with your file system of choice, like

Read Binary File, Spreadsheet File, Postgres
Data & Sheets

CSV is a super useful and universal way to transfer data between different tools. This workflow gives an example of how to take data from PostgreSQL and convert it easily into a CSV.

Spreadsheet File, Postgres
Data & Sheets

Convert Sql Table Into Excel Spreadsheet. Uses manualTrigger, mySql, spreadsheetFile, stickyNote. Event-driven trigger; 5 nodes.

MySQL, Spreadsheet File