Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

PostgreSQL: Copy/paste resulting with headers into Excel without code

I used MS SQL Server 2008 R2 (MS SQL) where I could right click the query result, copy/paste it with headers to Excel for easy exploration. Now with PG Admin (PostgreSQL) I have to do export (File > Export > CSV) then bunch of Excel steps (Text To Columns).

Is there an easy way to copy/paste the query result with headers into Excel?

like image 317
user2051936 Avatar asked Feb 07 '13 18:02

user2051936


People also ask

How do I copy column headers?

Select cells from the columns you want to copy (CTRL+Click), choose "Copy selected Headers" in Results grid context menu and column names will be copied to clipboard. This action creates a comma-separated list that can be pasted wherever you need.

What is psql's \copy?

Using the \copy command to import data to a table on a PostgreSQL DB instance. The PostgreSQL \copy command is a meta-command available from the psql interactive client tool. You can use \copy to import data into a table on your RDS for PostgreSQL DB instance.

How do I export query results to excel in pgAdmin 4?

In PgAdmin 4 simply press F8 button to export the data to excel CSV file or click on download button provided in application.


1 Answers

For pgAdmin 4, there is an option to "Copy with headers". It is a drop-down beside the copy button in the Query Tool menu:

Drop-down beside Copy button

like image 145
Nico Mongcal Avatar answered Sep 23 '22 02:09

Nico Mongcal