PostgreSQL: Export Data to Excel
PostgreSQL: Export Data to Excel
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
Post a Comment