UNIX - how to send attach excel in mail


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting UNIX - how to send attach excel in mail
# 1  
Old 06-27-2014
UNIX - how to send attach excel in mail

Hi Experts,
i need your help here
Smilie

Need to send a report thru mail using unix shell script(AIX). can you help me to do this? . i tried "uuencode" with CSV format, but while reading report all values are in single column. i need each column values in separate cell.

Thanks in advance...
# 2  
Old 06-27-2014
Welcome newbieabc,

Are you saying that the file was attached to the email okay? If so, then we need to check the format of your file.

Excel can read most things quite well, but I think your file is space separated. If you use a comma to separate the columns and then see what Excel makes of it, that might help. The CSV does stand for Comma Separated Values after all.

If this still doesn't help, change it to be a .txt file and then Excel will launch the import wizard and guide you through opening it where you can tell it the column separators/delimiters or fixed column widths or whatever.



I hope that this helps. Let us know how you get on.


Robin
# 3  
Old 06-27-2014
It's also possible that you forgot to add carriage returns to your file before you sent it. Windows/Excel expects these, it will not see \n by itself as an indicator of a new line. To add them to a file:

Code:
sed 's/$/\r/' < input.csv > output.csv

These 2 Users Gave Thanks to Corona688 For This Post:
# 4  
Old 06-27-2014
Hi Robin,
Thank you very much for replying,
yes, i am able to send the file via mail (attachment). While opening the file in excel (whatever the format .CSV or .xls) the outputs are in single column.

eg:
Code:
A1 B1 C1 D1 E1...
hello welcome to unix forum

But i want like this.
Code:
A1... B1....... C1 D1.. E1....
hello welcome to unix forum

this should me done in shell script. i dont want to do anything in excel.

Please help me.

thanks,

---------- Post updated at 03:12 AM ---------- Previous update was at 03:07 AM ----------

Hi Corona688,

Thanks for your suggestion. I tried it, it didn't work. Can you please help?

Thanks,
Moderator's Comments:
Mod Comment Spaces are not trimmed by this site when you use CODE tags. If you don't use CODE tags, normal HTML processing will coalesce adjacent whitespace. However, there are single spaces in your sample input (even after CODE tags have been added).

Last edited by Don Cragun; 06-27-2014 at 07:02 PM.. Reason: Add CODE tags.
# 5  
Old 06-27-2014
Post a sample of your csv file.

Also, "it didn't work" is not a useful description to anyone trying to help. Did it generate an error, produce the wrong (or no) output? What?
# 6  
Old 06-27-2014
Hi CarloM,
Sorry for the inconvenience,
It doesn't produce any error. but outputs are in single column, doesn't intended in Excel.

Here is my sample code:

Code:
ls -ltr /home/$USER >~/log.csv
sed 's/$/\r/' <~/log.csv >~/log1.csv
uuencode log1.csv log.csv >report
mail -s "Report" #email_id# <report

Thanks,
# 7  
Old 06-27-2014
Code:
ls -ltr /home/$USER

That's not going to have any commas in it - hence, only 1 column.

Do you want all the data from ls, or just the filenames?
This User Gave Thanks to CarloM For This Post:
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. UNIX for Advanced & Expert Users

How can I send a mail from my outlook or other mail accounts to UNIX server?

Hi all, I want to send a mail for my business needs from outlook account to an unix server (HP-UX) but I don't send any mail. While I can send from the unix server to my outlook account, I can't send from outlook to unix. How can I achieve this ? How can I send a mail from my outlook or other... (2 Replies)
Discussion started by: igelegin
2 Replies

2. Shell Programming and Scripting

How to attach multiple file to send mail command

Hi, i want color effect on mail as well as multiple attachment.I have code but this code is used for single attachment. I am unable to attach more than one file.:wall: I want to send two attachments -ahmed.csv and ahmed1.csv . Sample content: <html> <body> <b> Hi...</b> </body> </html> ... (1 Reply)
Discussion started by: AhmedLakadkutta
1 Replies

3. HP-UX

How to attach an excel file in a multipart (mime) mail

Hello. I need to send mails from hp-ux with 2 attachments: a text file and an excel file. So I'm composing a mime file which I will pipe to sendmail utility. This works fine if the only attachment is the text file (i use cat command to attach text content). But I have problems with the format... (3 Replies)
Discussion started by: elcampio
3 Replies

4. Shell Programming and Scripting

UNIX -> send data as excel in seperate cells

Hi I have a data file in UNIX as follows. I need to send this file in Mail as excel format. but the problem i face is i get the data all in single cells per row. what can i do to get the data in seperate cells. File -> attachment.xls data data data data data1 data1 ... (1 Reply)
Discussion started by: vj8436
1 Replies

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

6. Shell Programming and Scripting

Send email with attachment in form of excel in unix

Hi, I have a shell script which send email with an attachment in the form of an email. However, the when I open the attachment, all the data comes in one column. How do I format the data in the excel sheet while sending the email? Thanks (8 Replies)
Discussion started by: bdebroy
8 Replies

7. Shell Programming and Scripting

How to attach a file & send mail thru script

In shell script how can I attach a file and send a mail. suppose if I written like the following way usr/bin/mail 'subject" "mail_id" < file. a mail goes to the mail-id with the content of file.But I want the file to be atttached to the mail.How can I get it.is there any way for this. ... (9 Replies)
Discussion started by: Mar1006
9 Replies

8. UNIX for Dummies Questions & Answers

I am not able to send mail form unix to other mail accounts.

Using Mailx command i.e mailx -s "subject" chinni@hotmail.com < \tmp\chin this command executed sucessfully but not able to receive the mail in chinni@hotmail.com please help. (1 Reply)
Discussion started by: chinnigd
1 Replies

9. Shell Programming and Scripting

How to attach an excel file/ dat file thru unix mails

Hi. I want to attach a .xls or .dat file while sending mail thru unix. I have come across diff attachments sending options, but allthose embeds the content in the mail. I want the attachement to be send as such. Please help me out. regards Diwakar (1 Reply)
Discussion started by: diwakar82
1 Replies

10. UNIX for Dummies Questions & Answers

can not send mail from unix server to company/yahoo mail

hi, Gurus, I need some help with sending mail out from my UNIX server: It is running Solaris 2.6 and the sendmail version is 8.8. Output of :/usr/lib/sendmail -d0.1 -bt < /dev/null Version 8.8.8+Sun Compiled with: LOG MATCHGECOS MIME7TO8 MIME8TO7 NAMED_BIND NDBM NETINET ... (5 Replies)
Discussion started by: b5fnpct
5 Replies
Login or Register to Ask a Question