pgsql->ms excel

Started by Peter Pilslabout 24 years ago6 messagesgeneral
Jump to latest
#1Peter Pilsl
pilsl@goldfisch.at

Is there some ready2use or almostready2use-solution for converting a
pgsql-table into a ms-excel .xls-file ?

I dont think its a big deal using the appropriate perl-module but if
someone already did the work, I dont want to do it again.
If nobody did it : I'll do it and post it here if I succeed.

thnx,
peter

#2Serkan Bektaş
sbektas@karincaint.com.tr
In reply to: Peter Pilsl (#1)
Re: pgsql->ms excel

PgAdminII for Windows has an SQL tool that you can set the result ( To
Screen, To ASCII Text, Basic Html or Ole Link to MsExcel)

Serkan

-----Original Message-----
From: pgsql-general-owner@postgresql.org
[mailto:pgsql-general-owner@postgresql.org]On Behalf Of pilsl@goldfisch.at
Sent: 19 Subat 2002 Sali 14:27
To: pgsql-general@postgresql.org
Subject: [GENERAL] pgsql->ms excel

Is there some ready2use or almostready2use-solution for converting a
pgsql-table into a ms-excel .xls-file ?

I dont think its a big deal using the appropriate perl-module but if
someone already did the work, I dont want to do it again.
If nobody did it : I'll do it and post it here if I succeed.

thnx,
peter

---------------------------(end of broadcast)---------------------------
TIP 5: Have you checked our extensive FAQ?

http://www.postgresql.org/users-lounge/docs/faq.html

#3Herbert Liechti
Herbert.Liechti@thinx.ch
In reply to: Serkan Bektaş (#2)
Re: pgsql->ms excel

On Tue, 19 Feb 2002 pilsl@goldfisch.at wrote:

Is there some ready2use or almostready2use-solution for converting a
pgsql-table into a ms-excel .xls-file ?

I dont think its a big deal using the appropriate perl-module but if
someone already did the work, I dont want to do it again.
If nobody did it : I'll do it and post it here if I succeed.

There is a perl module Spreadsheet-WriteExcel for this purpose. In
combination with the DBI modules it is very easy to create any
excel sheets.

You may grab at the CPAN near you.

Best regards
Herbie

--
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Herbert Liechti http://www.thinx.ch
ThinX networked business services Adlergasse 5, CH-4500 Solothurn
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

#4Martijn van Oosterhout
kleptog@svana.org
In reply to: Peter Pilsl (#1)
Re: pgsql->ms excel

On Tue, Feb 19, 2002 at 01:26:31PM +0100, pilsl@goldfisch.at wrote:

Is there some ready2use or almostready2use-solution for converting a
pgsql-table into a ms-excel .xls-file ?

I dont think its a big deal using the appropriate perl-module but if
someone already did the work, I dont want to do it again.
If nobody did it : I'll do it and post it here if I succeed.

Method 1.

psql dbname -F, -A -t -c 'select * from table' > table.csv

You can load it into excel then. You can replace the comma with a tab (if
you quote appropriately)

Method 2.

Install ODBC driver in MS Access, link the table, open it and export as .xls

HTH,

--
Martijn van Oosterhout <kleptog@svana.org>
http://svana.org/kleptog/

Show quoted text

Terrorists can only take my life. Only my government can take my freedom.

#5Peter Pilsl
pilsl@goldfisch.at
In reply to: Serkan Bektaş (#2)
Re: pgsql->ms excel

On Tue, Feb 19, 2002 at 02:43:49PM +0200, Serkan Bekta? wrote:

PgAdminII for Windows has an SQL tool that you can set the result ( To
Screen, To ASCII Text, Basic Html or Ole Link to MsExcel)

but PgAdmin only allows to admin a psql-database but not to
access/print the actual content !?

additionally I need a fully automated solution, cause the excel-file
needs to be created automatically every morning, so the persons of the
higher managment can download them to their cheap subnotebooks and
dont need use the webinterface to the sql-table like the normal people
do ;) (I dont think they can use excel anyway but who cares :)

peter

Show quoted text

Serkan

-----Original Message-----
From: pgsql-general-owner@postgresql.org
[mailto:pgsql-general-owner@postgresql.org]On Behalf Of pilsl@goldfisch.at
Sent: 19 Subat 2002 Sali 14:27
To: pgsql-general@postgresql.org
Subject: [GENERAL] pgsql->ms excel

Is there some ready2use or almostready2use-solution for converting a
pgsql-table into a ms-excel .xls-file ?

I dont think its a big deal using the appropriate perl-module but if
someone already did the work, I dont want to do it again.
If nobody did it : I'll do it and post it here if I succeed.

thnx,
peter

---------------------------(end of broadcast)---------------------------
TIP 5: Have you checked our extensive FAQ?

http://www.postgresql.org/users-lounge/docs/faq.html

#6Peter Pilsl
pilsl@goldfisch.at
In reply to: Martijn van Oosterhout (#4)
Re: pgsql->ms excel

On Tue, Feb 19, 2002 at 11:53:09PM +1100, Martijn van Oosterhout wrote:

On Tue, Feb 19, 2002 at 01:26:31PM +0100, pilsl@goldfisch.at wrote:

Is there some ready2use or almostready2use-solution for converting a
pgsql-table into a ms-excel .xls-file ?

I dont think its a big deal using the appropriate perl-module but if
someone already did the work, I dont want to do it again.
If nobody did it : I'll do it and post it here if I succeed.

Method 1.

psql dbname -F, -A -t -c 'select * from table' > table.csv

didnt think about csv ... this seems to be a very fine solution ..

Install ODBC driver in MS Access, link the table, open it and export as .xls

I forgot to mention that the process needs to be fully automated and
performed on the linux-server only, so the ODCB-method (which would be
the best) does not work.

thnx a lot,
peter