mail a csv file as an excel sheet!


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting mail a csv file as an excel sheet!
# 1  
Old 04-05-2011
mail a csv file as an excel sheet!

Hi,

The result of a script is a csv file in the following format:
Code:
cat $file_name
DATA_USAGE_FACT,YES_NO_FLG,TARGET_TABLE,YES_NO_FLG,1,0,15,0
DATA_USAGE_FACT,DATE_OF_CREATION,TARGET_TABLE,DATE_OF_CREATION,29,9,19,0
DATA_USAGE_FACT,UPDATION_DATE,TARGET_TABLE,UPDATION_DATE,29,9,19,0
DATA_USAGE_FACT,INSTALLATION_DATE,TARGET_TABLE,INSTALLATION_DATE,29,9,19,0
DATA_USAGE_FACT,ASSET_CODE,TARGET_TABLE,ASSET_CODE,15,0,3,0

which I want to send in an excel sheet. What I'm doing is
Code:
 
unix2dos $file_name | uuencode $file_name $file_name.xls | mailx -s "Usage Sheet" <mail_id>

And though I get the above .xls sheet as an attachment in the mail; still the data inside it is in csv format only. It doesn't come in separate cells as intended.
I even tried
Code:
 
unix2dos $file_name > $file_name_dos
uuencode $file_name_dos $file_name_dos.xls | mailx -s "Usage Sheet" <mail_id>

but to no avail.

I've searched the forum and came accross a reverse requirement
https://www.unix.com/unix-dummies-que...lete-cell.html
there the csv data was actually coming in separate cells!!Smilie

Please advice.

-dips
# 2  
Old 04-05-2011
Use ';' instead of ',' in your csv file. In your locale the comma is the decimal separator and Excel can't use it as a field separator.
# 3  
Old 04-05-2011
Quote:
Originally Posted by Dahu
Use ';' instead of ',' in your csv file. In your locale the comma is the decimal separator and Excel can't use it as a field separator.
It's not working!! Smilie

With the original approach i.e. while using "," comma as delimiter I could manually convert .csv file to .xls by using "Text to Columns" option available in excel. But it doesn't get converted to an excel sheet when opened.

-dips
# 4  
Old 04-05-2011
XLS is a proprietary binary format, developed and distributed by Microsoft alone. There's no default UNIX tool that can convert a CSV (text format) to XLS automatically. One way to do what you want would be to create a script based on Spreadsheet::WriteExcel to convert your data.

Also, if you had used the sites search feature, as suggested in the rules, you'd have found a lot of threads dealing with the issue. Thus: Thread closed.
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Need to convert text file into Excel sheet

:cool:Hi, Iam new to this Scripts and forum too. Plz excuse if may i ask silly questions now and further.. Prob: i need to convert txt files data into excel sheet. Suppose if i have hour-wise data in txt file1 and file2 like file1 file2 00: 140 00: 235 01: 160 01:415... (1 Reply)
Discussion started by: mrudula
1 Replies

2. Shell Programming and Scripting

Summing up the data from different excel sheet into one excel sheet

Hi Folks, Can you please advise for any script in unix such that for example , i have 3 different excel sheet at the location /ppt/gfr/exc so the name s of the excel sheet are 1excel.xslx 2excel.xslx 3excel.xslx now in these 3 different excel sheet there is lot of data for example each... (3 Replies)
Discussion started by: punpun66
3 Replies

3. Shell Programming and Scripting

Shell Script for copying text file to Excel Sheet

Hi, I want to write a program to copy a log file to Excel sheet. Excel sheet has four columns MethodName , Code , Description, Details and Time. I want to pick these info from text file and put it in excel sheet. here is how the text file looks - 04.17.2014 08:06:12,697... (1 Reply)
Discussion started by: hershey
1 Replies

4. Shell Programming and Scripting

Perl : to get all the hyperlinks from the xlsx sheet(hyperlinks not visible in excel sheet directly)

Hi folks, I have a requirement in perl to print all the hyperlink from the spreadsheet(xlsx). Spreadsheet contains few lines of hyperlink data (pic attached). P.S. Hyperlink is behind the data and not visible in excel sheet directly. Now using perl script I need to copy the hyperlinks in... (3 Replies)
Discussion started by: scriptscript
3 Replies

5. Shell Programming and Scripting

Copy Data from CSV file to Excel Sheet using Perl

Hi All, Firstly I will like to wish A Happy New Year to all. Now my issue is I have one csv file say(data.csv) and one excel file say(result.xls) The result.xls contains two sheet name Sheet1 and Sheet2, Now What I am trying to do is to First I want to delete that data of Sheet2 if present any,... (6 Replies)
Discussion started by: adisky123
6 Replies

6. Shell Programming and Scripting

a shell script to generate an excel sheet from a text file..

hi, i have a text file that looks like this! i want to generate an excel sheet out of it, removing all the junk data except the addresses that look like . Arrow Electrical Services Rotating Machinery, Electrical Contracting & Mining Specialists Onsite maintenance, breakdown... (8 Replies)
Discussion started by: vemkiran
8 Replies

7. Red Hat

HOWTO transfer Hosts in excel sheet to file in LINUX?

Hi guys! I have around 300 hostsname is excelsheet in one column. These hosts I want to add in one file in linux one after the another like hostname1,hostname2.hostname3, I don't want to waste enter it manually it very time consuming, so how to transfer these files from excelsheet to a... (1 Reply)
Discussion started by: manalisharmabe
1 Replies

8. UNIX for Dummies Questions & Answers

How to store the flat file in an excel sheet

Hi, I need to automate a script. The process in the script is as follows Running the script abc.ksh The report is stored in xyz (flat file) Need to store the flat file content in an excel sheet. Your reply is highly appreciated. Thanks, Karthick (2 Replies)
Discussion started by: karthickrn
2 Replies

9. Shell Programming and Scripting

How to convert the data into excel sheet and send mail using 'mailx' command

Hi all I have a shell script that uses a stored proc to generate output from some tables and send the same in an e-mail using mailx command. Now I need to convert the output to excel format and send e-mail. How can I achieve this. Please help me in this regard, as it's very urgent and I have been... (5 Replies)
Discussion started by: sanbabu
5 Replies

10. UNIX for Advanced & Expert Users

Insert csv into special sheet of excel

Hi, I need a script that can insert csv file into the special sheet of excel (other sheets in this excel include charts which use data of the special sheet). Could you help me please? (2 Replies)
Discussion started by: Elena
2 Replies
Login or Register to Ask a Question