Skip to content
FlowHubFluxonLab
Postgres
PostgreSQLfree

Convert PostgreSQL table to CSV

by Alex Emerichadapted from n8n official workflow galleryUpdated Aug 2026
RequiresPostgresPostgres
Share Post Share
MaWhen clicking "Execute Workflow"When clicking "…SFSpreadsheet FileSeTableNamePostgres123
1/5
STEPS · 3
Run manually by an operator

Convert PostgreSQL table to CSV 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. What you need Before running the workflow, please make sure you have access to a remote PostgreSQL server and have table data: book_title,book_author,read_date Demons,Fyodor Dostoyevsky,2022-09-08 Ulysses,James Joyce,2022-05-06 Catch-22,Joseph Heller,2023-01-04 The Bell Jar,Sylvia Plath,2023-01-21 Frankenstein,Mary Shelley,2023-02-14 How it works Trigger the workflow on click Declare the name of the Excel file and sheet names Remotely connect to the PostgreSQL database and specify query execution Write the query data to CSV The detailed process is explained further in the tutorial: https://blog.n8n.io/postgres-export-to-csv/

Tags

n8nreference-onlypostgres
Connects
postgresPostgres
CategoryPostgreSQL
Triggermanual
Complexitysimple
Nodes4
AddedMar 20, 2023

Related workflows

See all PostgreSQL
postgres
free

Insert Excel data to Postgres

Read XLS from file Convert it to JSON Insert it in Postgres

by Jan Oberhauser
postgres
free

Transfer data from Postgres to Excel

Read data from Postgres Converting it to XLS Save it to disk

by Jan Oberhauser
postgres
free

Generate and insert data into a Postgres database

This is Workflow 1 in the blog tutorial Database activity monitoring and alerting. Prerequisites A Postgres database set up and credentials. Basic knowledge of JavaScript and SQL. Nodes Cron node starts the workflow every minute. Function node generates sensor data (sensor id (preset), a randomly generated value, timestamp, and notification (preset as false) ) Postgres node inserts the data into a Postgres database. You can create the database for this workflow with the following SQL statement: CREATE TABLE n8n (id SERIAL, sensor_id VARCHAR, value INT, time_stamp TIMESTAMP, notification BOOLEAN);

by tanaypant