# Databases > Oracle I want SQL query output into excel

## arvi.sardar

I am using Oracle 8i, I want SQL query output into excel. Query is 

Select partno, partname,uob from partmast

I want all record from this query are display into excel sheet how it will be possible.  (uob is unit of measure) I solve this query by using spool but query result written into the text file but i want into excel. Give me soln for this 

Arvind

----------


## debasisdas

U can't do that directly from SQL*PLUS

try to use any third party tool 
or 
by using any frontend application.

----------


## jamesravid

Hi 

You can do it using spool command. you need to spool the query output to a *csv* file. 

and you need to modify ur query so that all the column values are separated my comma. Let me give you an example,

select emp_id || ',' || emp_name ||',' || hire_date from emp;

this query will return you only one column with values like

12,james,01-jan-2005
13,ravi,01-jun-2005

Please go thru this link for further assistance
http://www.oracledbaexpert.com/oracl...ormatting.html

Hope this helps you

----------


## jakilati

James, how to insert all the records into csv file using cursors?

----------


## Ash4u

The same can be done using third party tool

----------


## sreekumar_nair_it

> I am using Oracle 8i, I want SQL query output into excel. Query is 
> 
> Select partno, partname,uob from partmast
> 
> I want all record from this query are display into excel sheet how it will be possible.  (uob is unit of measure) I solve this query by using spool but query result written into the text file but i want into excel. Give me soln for this 
> 
> Arvind


Dear ARVI,


Good Morning

Try these steps:

1) Spool test.txt
    Select * from CMSLOANISSUETRANSACTION;
    Spool off;
2) Open MS-Excel
3) Open the test.txt file in Excel.
4) A wizard will be opened with two options
    Specify from where to start, i mean, specify row number in the option Start import at row and click next.
5) Use the break line as required and click finish.

I hope this will help you.

Have a pleasant time.

----------


## sreekumar_nair_it

Dear ARVI,


Good Morning

Try these steps:

1) Spool test.txt
    Select partno, partname,uob from partmast
    Spool off;
2) Open MS-Excel
3) Open the test.txt file in Excel.
4) A wizard will be opened with two options
    Specify from where to start, i mean, specify row number in the option Start import at row and click next.
5) Use the break line as required and click finish.

I hope this will help you.

Have a pleasant time.

----------

