Export SQL Results To Excel Using SQLPLUS

by Prashant on November 4, 2014

in PeopleSoft Basics

Here is quick tip on how to easily export SQL results into an excel file.

Step 1: Login into database using SQL PLUS

Step 2: Set markup using below command

SET MARKUP HTML ON

Step 3: Spool the output to a file.

SPOOL C:\TEMP\MYOUTPUT.XLS

Step 4: Run your SQL Query

SQL QUERY

image

Step 5: Set the Spool Off.

image

Step 6: Open the output XLS file to view the output.

Also Read:  How To Show Database Name in PeopleSoft Application Designer

{ 3 comments… read them below or add one }

Ramesh Kummara December 15, 2014 at 7:00 am

Thanks for the tips

Reply

srinivas June 23, 2017 at 1:57 pm

Good tip.

how to avoid break/titles per every 14 rows.

PROJECTNAME DESCRLONG
….
…..
….

PROJECTNAME DESCRLONG

Reply

vidur July 1, 2017 at 1:16 pm

I tried the above solution to send output of a query from sql*plus to an excel file, it works fine.
But column headings are appearing after every 15 rows in the excel sheet, i want the headings to appear once only, what can i do to get rid of this problem?

Reply

Leave a Comment

Previous post:

Next post: