Geeks Talk

Prepare for your Next Interview


Welcome to the Geeks Talk forums.

You are currently viewing our boards as a guest which gives you limited access to view most discussions and access our other features. By joining our free community you will have access to post topics, communicate privately with other members (PM), respond to polls, upload content and access many other special features. Registration is fast, simple and absolutely free so please, join our community today!

If you have any problems with the registration process or your account login, please contact contact us.

Excel Convertion

This is a discussion on Excel Convertion within the Oracle forums, part of the Databases category; I am using the following script to send output of a query to excel file. Set markup html on SET LINESIZE 2000 Spool test1.xls Select * from CMSLOANISSUETRANSACTION; Spool off ...

Go Back   Geeks Talk > Databases > Oracle
Register Blogs FAQ Tag Cloud Calendar Mark Forums Read

Oracle Oracle 9i & Oracle 10g Knowledge Base Learn and Share Oracle Technology related articles, white papers, tutorials / study materials, example codes, FAQ's, Tips and Tricks.

Reply

 

LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 12-02-2007
Expert Member
 
Join Date: Sep 2007
Posts: 738
Thanks: 22
Thanked 67 Times in 65 Posts
krishnaindia2007 is on a distinguished road
Excel Convertion

I am using the following script to send output of a query to excel file.

Set markup html on
SET LINESIZE 2000
Spool test1.xls
Select * from CMSLOANISSUETRANSACTION;
Spool off


The entire row is converted into a single cell. How to send each column value into a seperate cell while sending output to excel file?
Reply With Quote
Sponsored Links
  #2 (permalink)  
Old 12-03-2007
Contributing Member
 
Join Date: Nov 2007
Location: India
Posts: 63
Thanks: 5
Thanked 8 Times in 7 Posts
sreekumar_nair_it is on a distinguished road
Re: Excel Convertion

Quote:
Originally Posted by krishnaindia2007 View Post
I am using the following script to send output of a query to excel file.

Set markup html on
SET LINESIZE 2000
Spool test1.xls
Select * from CMSLOANISSUETRANSACTION;
Spool off


The entire row is converted into a single cell. How to send each column value into a seperate cell while sending output to excel file?
Dear krishnaindia2007,

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.
Reply With Quote
  #3 (permalink)  
Old 12-03-2007
Contributing Member
 
Join Date: Nov 2007
Location: India
Posts: 63
Thanks: 5
Thanked 8 Times in 7 Posts
sreekumar_nair_it is on a distinguished road
Re: Excel Convertion

Quote:
Originally Posted by krishnaindia2007 View Post
I am using the following script to send output of a query to excel file.

Set markup html on
SET LINESIZE 2000
Spool test1.xls
Select * from CMSLOANISSUETRANSACTION;
Spool off


The entire row is converted into a single cell. How to send each column value into a seperate cell while sending output to excel file?
Dear krishnaindia2007,

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.
Reply With Quote
  #4 (permalink)  
Old 12-03-2007
Contributing Member
 
Join Date: Nov 2007
Location: India
Posts: 63
Thanks: 5
Thanked 8 Times in 7 Posts
sreekumar_nair_it is on a distinguished road
Re: Excel Convertion

Dear krishnaindia2007,

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.
Reply With Quote
  #5 (permalink)  
Old 12-03-2007
Expert Member
 
Join Date: Sep 2007
Posts: 738
Thanks: 22
Thanked 67 Times in 65 Posts
krishnaindia2007 is on a distinguished road
Re: Excel Convertion

Still it is importing entire row into a signle cell not each column into a seperate cell.
Reply With Quote
  #6 (permalink)  
Old 12-03-2007
Expert Member
 
Join Date: Apr 2007
Location: Bangalore
Posts: 518
Thanks: 30
Thanked 63 Times in 61 Posts
susarlasireesha will become famous soon enough
Re: Excel Convertion

We can use plsql script to load oracle data to excel with out using any tools
This is a sample code use this...
PROCEDURE EXCEL_FILE IS
cursor dtl is select * from accounts_icd order by auth_dt,ich_ven_cd;
row_num number;
col_num number;
cell_val number;
app_acc OLE2.OBJ_TYPE;
dbs OLE2.OBJ_TYPE;
dc OLE2.OBJ_TYPE;
args_acc OLE2.OBJ_TYPE;
app OLE2.OBJ_TYPE;
args OLE2.LIST_TYPE;
args2 OLE2.LIST_TYPE;
ws OLE2.OBJ_TYPE;
wb OLE2.OBJ_TYPE;
wss OLE2.OBJ_TYPE;
wbs OLE2.OBJ_TYPE;
cell OLE2.OBJ_TYPE;
ctr1 NUMBER := 0;
ctr2 NUMBER := 0;
ctr3 PLS_INTEGER := 0; --NUMBER := 0;
m_row number:=1;
m_len number:=0;
m_flag number:=0;
Begin

---------------- Initialise Excel

app := OLE2.CREATE_OBJ('Excel.Application');
OLE2.SET_PROPERTY(app, 'Visible','True');
wbs := OLE2.GET_OBJ_PROPERTY(app,'Workbooks');
wb := OLE2.INVOKE_OBJ(wbs,'Add');
wss := OLE2.GET_OBJ_PROPERTY(app,'Worksheets');
ws := OLE2.INVOKE_OBJ(wss,'Add');

---
For I in 1..2 loop
args := OLE2.CREATE_ARGLIST;
OLE2.ADD_ARG(args, m_row); --- Row
OLE2.ADD_ARG(args, I); --- Column
cell := OLE2.GET_OBJ_PROPERTY(ws,'Cells', args);
OLE2.DESTROY_ARGLIST(args);
if I=1 then
OLE2.SET_PROPERTY(cell, 'Value','Auth. Date');
elsif I=2 then
OLE2.SET_PROPERTY(cell, 'Value','ICD Doc.No');
end if;
OLE2.RELEASE_OBJ(cell);
end loop;
--- Heading

-- Data

For J in Dtl loop

For I in 1..2 loop

-- Repeat Row
args := OLE2.CREATE_ARGLIST;

OLE2.ADD_ARG(args, m_row); --- Row
OLE2.ADD_ARG(args, I); --- Column

cell := OLE2.GET_OBJ_PROPERTY(ws,'Cells', args);
OLE2.DESTROY_ARGLIST(args);

if I=1 then
OLE2.SET_PROPERTY(cell, 'Value',J.AUTH_DT);
elsif I=2 then
OLE2.SET_PROPERTY(cell, 'Value',J.ICD_DOC_NO);
end if
end loop
end loop
---- End
OLE2.RELEASE_OBJ(wbs);
OLE2.RELEASE_OBJ(ws);
OLE2.RELEASE_OBJ(wbs);
OLE2.RELEASE_OBJ(wb);
OLE2.RELEASE_OBJ(app);
END;
Reply With Quote
The Following User Says Thank You to susarlasireesha For This Useful Post:
  #7 (permalink)  
Old 12-03-2007
Contributing Member
 
Join Date: Nov 2007
Location: India
Posts: 63
Thanks: 5
Thanked 8 Times in 7 Posts
sreekumar_nair_it is on a distinguished road
Re: Excel Convertion

Quote:
Originally Posted by krishnaindia2007 View Post
I am using the following script to send output of a query to excel file.

Set markup html on
SET LINESIZE 2000
Spool test1.xls
Select * from CMSLOANISSUETRANSACTION;
Spool off


The entire row is converted into a single cell. How to send each column value into a seperate cell while sending output to excel file?
Dear Krishnaindia2007,

Refer the attachment and try again
Attached Files
File Type: doc 1.doc (55.0 KB, 10 views)
Reply With Quote
The Following User Says Thank You to sreekumar_nair_it For This Useful Post:
Reply

  Geeks Talk > Databases > Oracle

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is On
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads

Thread Thread Starter Forum Replies Last Post
DML for excel csv source anil.kv Data Warehousing 2 09-25-2009 05:08 AM
Excel File instead of .TSR simanta.adhikary QTP 2 12-24-2007 02:37 AM
I want SQL query output into excel arvi.sardar Oracle 6 12-03-2007 12:30 AM
Change excel sheet Geek_Guest SilkTest 0 11-08-2007 05:35 AM
microsoft excel raj.aura Database General 1 04-26-2007 06:18 AM


All times are GMT -4. The time now is 06:58 AM.


Powered by vBulletin® Version 3.8.4
Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO 3.3.1
Copyright © 2009 GeekInterview.com. All Rights Reserved