Re: Table to Excel

From: Josh Trutwin <josh(at)trutwins(dot)homeip(dot)net>
To: pgsql-sql(at)postgresql(dot)org
Subject: Re: Table to Excel
Date: 2009-03-26 14:05:12
Message-ID: 20090326090512.476f2aa4@sinkhole.intrcomm.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

On Thu, 26 Mar 2009 08:04:25 +0100
Pavel Stehule <pavel(dot)stehule(at)gmail(dot)com> wrote:

> hello
>
> use csv format - excel have to read this format without any format
>
> COPY tablename TO '...' CSV;

Another possibility that I use often is to set the output to HTML
mode using:

\H

Then set to send query results to a file:

\o myresults.html

Then run a single query:

SELECT col1, col2 FROM foo WHERE bar = '1' ORDER BY baz;

\q

Now you can open your .html file directly into Excel since it's just
a big html table.

Josh

In response to

Responses

Browse pgsql-sql by date

  From Date Subject
Next Message Pavel Stehule 2009-03-26 16:30:44 Re: Table to Excel
Previous Message Albe Laurenz 2009-03-26 09:44:34 Re: [ADMIN] Can we load all database objects in memory?