PostgreSQL: Export Data to Excel

PostgreSQL: Export Data to Excel

novicetechie

The easiest way to export PostgreSQL data to Excel is by using the CSV format.

Export Table to CSV


COPY employee
TO '/tmp/employee.csv'
DELIMITER ','
CSV HEADER;

Export Query Result


COPY (
  SELECT * FROM employee WHERE role = 'Developer'
)
TO '/tmp/developers.csv'
CSV HEADER;

The exported CSV file can be opened directly in Microsoft Excel.

Comments

Simple Tech Tips for Everyday Users

Learn easy tech solutions, beginner-friendly tutorials, and simple fixes for your phone, laptop, apps, and internet problems — all in one place.

Explore by Category

About NoviceTechie

NoviceTechie.com is your simple tech helper. We provide beginner-friendly tutorials, how-to guides, and easy troubleshooting tips to make technology easier for everyone — no technical knowledge required.

Latest Posts

Get Simple Tech Tips Weekly

Join our free updates (optional).

Follow Us
NoviceTechie.com — Simple tech tutorials, everyday problem fixes, and easy guides for beginners.