Visit Our UNIX and Linux User Community


Output in xls format


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Output in xls format
# 1  
Old 09-17-2013
Output in xls format

Hi,

I need the output of sql query which is executed using a shell script to xls file format.
# 2  
Old 09-17-2013
Would CSV be acceptable? Excel also opens this natively, and it's extremely easy to make from shell. XLS on the other hand would probably need you to install a bunch of Perl modules.
# 3  
Old 09-17-2013
Yes csv format also be acceptable.
# 4  
Old 09-17-2013
You can even generate csv with the xls extension, which helps ensure it is saved as xls, as I recall. The rules for CSV are simple (but more than just commas):
  1. Double any double quotes to escape them.
  2. Wrap Cells containing any comma, carriage return or line feed in double quotes ("). Paranoid people double quote every cell, which is legal, just wasteful.
  3. Separate cells with commas (,).
  4. End rows with carriage return and then line feed ( \r\n or ^M^J ). In practice, I have seen it happy enough with just linefeed, but that is the spec.
Some old Access versions did not follow the rules properly, sending me to tab separated txt, also nice as tab is not very popular inside cells. If you follow these rules, you can encapsulate anything.
# 5  
Old 09-17-2013
Set sqlplus system variable COLSEP to comma to produce a comma separated output.

Refer: COLSEP
# 6  
Old 09-17-2013
Can you pls provide me with an example?
# 7  
Old 09-17-2013
Yoda: '... as long as there are no commas, double quotes or linefeeds in your cells.'

---------- Post updated at 04:28 PM ---------- Previous update was at 04:24 PM ----------

Code:
 
1,two,"three,
and more three
and then ""How are you, Sir?""
ok enough",4,5.555\r
2,four,six,8,11.1110\r
(EOF)


Previous Thread | Next Thread
Test Your Knowledge in Computers #581
Difficulty: Easy
In a typical unix-based system, everything is a file.
True or False?

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Converting text files to xls through awk script for specific data format

Dear Friends, I am in urgent need for awk/sed/sh script for converting a specific data format (.txt) to .xls. The input is as follows: >gi|1234|ref| Query = 1 - 65, Target = 1677 - 1733 Score = 8.38, E = 0.6529, P = 0.0001513, GC = 46 fd sdfsdfsdfsdf fsdfdsfdfdfdfdfdf... (6 Replies)
Discussion started by: Amit1
6 Replies

2. Shell Programming and Scripting

perl module to convert xlsx format to xls format

Hi Folks, I have written a perl script that reads data from excel sheet(.xls) using Spreadsheet::ParseExcel module. But the problem is this module doesn't work for excel sheets with extension .xlsx. I have gone through Spreadsheet::XLSX module with which we can read from .xlsx file directly.... (1 Reply)
Discussion started by: giridhar276
1 Replies

3. Shell Programming and Scripting

Clearcase ucm baseline differences report in xls format

Hi All, Can any one help me to get the shell/perl scripts for the below requirements. 1: To get the clearcase checkin's information between two lables generate a formatted Xls output and to find the added changed and removed files and versions between the ClearCase baselines. 2... (2 Replies)
Discussion started by: saku
2 Replies

4. 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

5. 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

6. 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

7. Shell Programming and Scripting

Convert a csv file to an xls format

Hi, I have a file coming in xxx.txt(csv format) i do some work on it and i need to send out as a .xls format. Is there any way there is some code i can use in my script to convert this? I'm struggling on this. Thanks (11 Replies)
Discussion started by: Pablo_beezo
11 Replies

8. Shell Programming and Scripting

Generating xls with utf-8 format

Hi All, This is my first mail to the group.I would like to generate an attachment in xls format which contains accented characters that are supported by UTF-8 format. However, I am not able to get them as i wished. Can anyone help me in this regard.I would like to know the mail format for... (0 Replies)
Discussion started by: kalyanramurs
0 Replies

9. Shell Programming and Scripting

conert the pipe delimated file into xls format

Hi I have spool file which is pipe delimated and i want to convert it into xls . Is any tool or method availabe in UNIX for this kind of conversion (2 Replies)
Discussion started by: prasadg
2 Replies

10. Shell Programming and Scripting

How to extract output from a script to .xls file

Hi, 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, Scriptlearner. (6 Replies)
Discussion started by: scriptlearner
6 Replies

Featured Tech Videos