Computing.Net > Forums > Unix > how to store the output file in .xls format

Computer Problems? Computing.Net has over 1,000,000 posts about all things technology related! Click here to start participating now! Also, check out the New User Guide.

how to store the output file in .xls format

Reply to Message Icon

Name: psiva_unix
Date: June 3, 2009 at 11:45:26 Pacific
OS: Windows XP
CPU/Ram: -
Product: Sun / --
Subcategory: General
Comment:

Hi,

i have ksh script to fetch the data from oracle database and store the output in a .xls or .csv file. But the output having more then 70,000 rows. How can i store those files in .xls or csv files.
Could you please suyggest is thre any other way to do that?




Response Number 1
Name: David Perry
Date: June 3, 2009 at 12:20:52 Pacific
+1
Reply:

Please provide a sample of the data returned by your script.



Response Number 2
Name: lankrypt0
Date: June 4, 2009 at 06:03:47 Pacific
+1
Reply:

also provide your script as an example.
The easiest way is to use the spool command passed to oracle, so it will look like:

spool filename1.csv
select foo||','||bar from data where hello is world;
spool filename2.csv
select foo||','||bar from database where stuff is thing;

the above will output multiple files for each query, if you want one file for all queries, do:

spool filename1.csv
select foo||','||bar from data where hello is world;
select foo||','||bar from database where stuff is thing;

the ||','|| inserts a comma between your selections, which is what you would want for a .csv file.
To convert a .csv to a .xls, see if csv2xls is installed.



Reply to Message Icon

Related Posts

See More


read id's from one text a... perl script


Use following form to reply to current message:

Login or Register to Reply
LoginRegister


Google Ads



Results for: how to store the output file in .xls format

How to keep the log file a fixed size www.computing.net/answers/unix/how-to-keep-the-log-file-a-fixed-size/2436.html

How to conver a text file into .xls www.computing.net/answers/unix/how-to-conver-a-text-file-into-xls/7761.html

how to get the last field www.computing.net/answers/unix/how-to-get-the-last-field/6529.html