Re: [SQL] exporting query result - Mailing list pgsql-sql

From Adrian Klaver
Subject Re: [SQL] exporting query result
Date
Msg-id 3d7d9782-0123-6d28-a661-a008ba3024e9@aklaver.com
Whole thread Raw
In response to Re: [SQL] exporting query result  (Günce Kaya <guncekaya14@gmail.com>)
Responses Re: [SQL] exporting query result  (Günce Kaya <guncekaya14@gmail.com>)
List pgsql-sql
On 05/12/2017 08:58 AM, Günce Kaya wrote:
> Hello,
>
> Thank you for your advice. But I did not want to ask about using Copy. I
> always use it but my requirement  is if there is anyway to export query
> result to CSV's different sheets.

CSV != spreadsheet. You can export to CSV using COPY or \copy in psql
and then import those into a spreadsheet. If you want something that
creates an xls(x) file directly then that is going to require a third
party software. I use Python for doing stuff like that. Some programs I
use are:

Pandas
http://pandas.pydata.org/pandas-docs/stable/io.html

XlsxWriter
http://xlsxwriter.readthedocs.io/

csvkit
http://csvkit.readthedocs.io/en/1.0.2/

FYI, csvkit is a collection of command line tools, so it just needs
Python to be installed.

>
> Regards,
> Gunce Kaya
>
>


--
Adrian Klaver
adrian.klaver@aklaver.com


pgsql-sql by date:

Previous
From: Günce Kaya
Date:
Subject: Re: [SQL] exporting query result
Next
From: Günce Kaya
Date:
Subject: Re: [SQL] exporting query result