Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.84_2) (envelope-from ) id 1d9DJi-0005Ow-9k for pgsql-sql@arkaria.postgresql.org; Fri, 12 May 2017 16:21:22 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.84_2) (envelope-from ) id 1d9DJh-0002By-Sg for pgsql-sql@arkaria.postgresql.org; Fri, 12 May 2017 16:21:21 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1d9DJg-000228-CD for pgsql-sql@postgresql.org; Fri, 12 May 2017 16:21:20 +0000 Received: from [195.159.176.226] (helo=blaine.gmane.org) by magus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.84_2) (envelope-from ) id 1d9DJd-0002xw-1t for pgsql-sql@postgresql.org; Fri, 12 May 2017 16:21:19 +0000 Received: from list by blaine.gmane.org with local (Exim 4.84_2) (envelope-from ) id 1d9DJV-0001wA-EA for pgsql-sql@postgresql.org; Fri, 12 May 2017 18:21:09 +0200 X-Injected-Via-Gmane: http://gmane.org/ To: pgsql-sql@postgresql.org From: Thomas Kellerer Subject: Re: exporting query result Date: Fri, 12 May 2017 18:21:08 +0200 Lines: 26 Message-ID: References: <4498cd4b-95b7-c4f5-add4-b6555267296a@aklaver.com> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 8bit X-Complaints-To: usenet@blaine.gmane.org User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; de; rv:1.8.1.21) Gecko/20090302 Thunderbird/2.0.0.21 Mnenhy/0.7.5.666 In-Reply-To: Content-Language: de-DE Cc: pgsql-admin@postgresql.org X-Host-Lookup-Failed: Reverse DNS lookup failed for 195.159.176.226 (failed) X-Pg-Spam-Score: -0.9 (/) List-Archive: List-Help: List-ID: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: X-Mailing-List: pgsql-sql Precedence: bulk Sender: pgsql-sql-owner@postgresql.org Günce Kaya schrieb am 12.05.2017 um 17:58: > 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. A CSV file has no sheets (it does not even have a "structure" as it is plain text). The tool I am maintaining can do you what you want (or at least what I think you want): It has a built-in command to export data to various formats including ODS or XLSX which you need in order to create multiple "sheets" The following command WbExport -file=data.xlsx -sourceTable=table_one,table_two, table_three; Creates a single XLSX file with three sheets, one for each table. You can download it here: http://www.sql-workbench.net/ For details on the WbExport command see here: http://www.sql-workbench.net/manual/command-export.html Disclosure: I am the author of that tool. Regards Thomas -- Sent via pgsql-sql mailing list (pgsql-sql@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-sql