Over a million developers have joined DZone.
{{announcement.body}}
{{announcement.title}}

Copying Postgres Output into a Spreadsheet

DZone's Guide to

Copying Postgres Output into a Spreadsheet

I often need to grab information from a Postgres database and paste it into a spreadsheet for sharing with others

· Database Zone
Free Resource

Whether you work in SQL Server Management Studio or Visual Studio, Redgate tools integrate with your existing infrastructure, enabling you to align DevOps for your applications with DevOps for your SQL Server databases. Discover true Database DevOps, brought to you in partnership with Redgate.

I often need to grab information from a Postgres database and paste it into a spreadsheet for sharing with others. Google Sheets needs the pasted data to be tab-separated in order to be correctly split into columns. This isn't the default behaviour for psql but here's how to configure psql's output to get it.

At a psql prompt, switch to unaligned output:

=> \a

and set the field separator to a tab character:

=> \f '\t'

then the output from subsequent SELECT ... statements can be cleanly pastedinto your Google Doc.

It’s easier than you think to extend DevOps practices to SQL Server with Redgate tools. Discover how to introduce true Database DevOps, brought to you in partnership with Redgate

Topics:
database ,sql ,postgres

Published at DZone with permission of David Winterbottom, DZone MVB. See the original article here.

Opinions expressed by DZone contributors are their own.

The best of DZone straight to your inbox.

SEE AN EXAMPLE
Please provide a valid email address.

Thanks for subscribing!

Awesome! Check your inbox to verify your email so you can start receiving the latest in tech news and resources.
Subscribe

{{ parent.title || parent.header.title}}

{{ parent.tldr }}

{{ parent.urlSource.name }}