How to extract output from a script to .xls file

Thread Tools Search this Thread
Top Forums Shell Programming and Scripting How to extract output from a script to .xls file
# 1  
Old 08-06-2007
How to extract output from a script to .xls file


I am running a script, the output of which is needed to be filled in .xls file. I am doing this manually now, i mean I am writing the output of the script to Excel file manually. How to redirect the output of the script to .xls file? Please help me out!!!

Thanks much,
# 2  
Old 08-06-2007
You can just format your output such that the values of the output are delimited to "," and are redirected to a CSV file.

So you can use to CSV file to view your output in the excel format
# 3  
Old 08-06-2007
You mean you are copying outputs from the screen to an excel file?

You can format your outputs in CSV format (like lorcan suggested) and redirect the script out to a file say,

$ sh > your_output.csv

does that help?
# 4  
Old 08-07-2007

Thanks a lot. Yep,it works if I am extracting output from .sh file. Actually I have one shell script i.e, in which it calls other .sql scripts which are in my home directory. Actually I wanted the output of .sql scripts to .csv file. I tried to get the output of .sql to .csv, but it is throwing error. Can I redirect the output from to myouput.csv?Is that possible? Please help me.

Thanks much in advance,
# 5  
Old 08-07-2007
You cannot redirect the SQL queries to the files. Instead you can use the spool concept in ORACLE (hope Oracle is the database).

Spool your output such that the records are comma separated.

something like the below;

select sysdate||","|| sysdate from dual;
spool on;
spool off;

This will have the output from the sql command into the Spool file.
# 6  
Old 08-10-2007
Thanks a lot for your help. I got that. Initially I got problem coz my.sql script had control characters in it. Now it is working fine.

Thanks a lot,
# 7  
Old 08-10-2007
If you want redirect the output file to .xls file from your script. you can use the following command,

$ shell_script.ksh > test.xls

Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Perl script to convert xlsx to xls file

Hi I am trying one perl script to convert xlsx to xls file but could not able to get all the rows and columns in the xls file . This scriptFILE is basically to convert XLSX to CSV .. I am tweaking the script to convert XLSX to XLS file also #######################FILE... (3 Replies)
Discussion started by: kshitij
3 Replies

2. UNIX for Advanced & Expert Users

Shell script for dealing with XLS file with multiple tabs/worksheets

Hey Guys , Recently working on a requirement , i had to deal with XLS file with multiple tabs and the requirement was as below : 1. Convert one XLS file with multiple tabs to multiple CSV files. -- As i was working on MAC , so it was quite easy through APPLESCRIPT to deal with this.But... (2 Replies)
Discussion started by: himanshu sood
2 Replies

3. Shell Programming and Scripting

Script to take .xls file and read it for each server

Script to take .xls file and read it for each server "/aix/test/$server_pre.xls" and then removes all the disks as provided in the file and then give output as below for each server, but am getting error where it says cannot find directory. server_name: server1 Disk Cleaned hdisk1 hdisk1... (2 Replies)
Discussion started by: aix_admin_007
2 Replies

4. Shell Programming and Scripting

Perl script to extract second column from a xls

Can Anyone tell me how to extract the second column of a xls sheet And compare the content of each row of the column with a .h file. xls sheet is having only one spreadsheet. (2 Replies)
Discussion started by: suvenduperl
2 Replies

5. Shell Programming and Scripting

Redirect the output to a .xls file

Hi, I am using the sybase database server though unix platform and try to retrieve some data by the help of select statement, and my main issue is i want to redirect all the the data i.e. retrieve from the select statement to a .xls file with the same column name and the outputs. How can i do... (5 Replies)
Discussion started by: anupdas
5 Replies

6. Shell Programming and Scripting

how to extract the data from database (oracle) and send the output as an .xls file?

Hi, How to extract the data from Oracle database and sent the output data to mails using mailx command with .xls attachement? Here i know how to connect the database using unix shell script and how to use the mailx command in UNIX script But i don't know how to use the .xls format file (i... (1 Reply)
Discussion started by: psiva_arul
1 Replies

7. Shell Programming and Scripting

How to create xls file using unix script

Hi All, I want to create an xls file using shell script. I mean that I have written one script. It is having sql output. So I want to save that sql output into one xls file and I want to send that file as a attachment to my team MAIL_IDs. Can You any guy help me in this? Thanks in... (3 Replies)
Discussion started by: raghu.iv85
3 Replies

8. Shell Programming and Scripting

Sending/append result from CSH script to xls file

Hi, 1st post... Done a quick search for this so apologies if I've missed it. Basically I want to output and and append several values generated by a csh script direct to an xls openoffice file, rather than send to txt file and then physically copy and paste to xls file. Already I send... (4 Replies)
Discussion started by: scottyjock
4 Replies

9. Shell Programming and Scripting

converting xls file to txt file and xls to csv

I need to convert an excel file into a text file and an excel file into a CSV file.. any code to do that is appreciated thanks (6 Replies)
Discussion started by: bandar007
6 Replies

10. UNIX for Dummies Questions & Answers

Unix script to convert .csv file to.xls format

I have a .csv file in Unix box i need a UNIX script to convert the.csv files to.xls format. Its very urgent please help me. (1 Reply)
Discussion started by: moon_friend
1 Replies
Login or Register to Ask a Question

Featured Tech Videos