Send email with attachment in form of excel in unix


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Send email with attachment in form of excel in unix
# 1  
Old 09-05-2007
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
# 2  
Old 09-05-2007
I have writed a perl script implement the similar function as you do, it works normally, how do you implement it?
# 3  
Old 09-05-2007
Send email with attachment in form of excel in unix

Hi,

The following in the code which I am using :

#!/bin/ksh
export ORACLE_HOME=/oracle/product/current
export PATH=$PATH:$ORACLE_HOME/bin

sqlplus -s schema/pswd@db <<EOF
set pagesize 200
set linesize 200
column Name format a25
column New_DeptName format a25
column Old_DeptName format a25
column New_Manager format a25
column Old_Manager format a25

spool $test.xls

SELECT a.first_name || ' ' || a.last_name Name, b.DEPTNAME New_DeptName ,
a.DEPARTMENT_NAME Old_DeptName, Get_New_Manager_Name(b.CS_DEPT_MGR_ID) New_Manager,
Get_Old_Manager_Name (a.manager_id) Old_Manager
FROM table1 a, table2 b,table3 c
WHERE a.emplid = c.emplid
AND a.EMPLID=b.emplid
AND b.EMPL_STATUS = 'A'
AND a.DEPARTMENT_ID <> b.deptid
order by Consultant_Name;
spool off
exit;
EOF


havingRows=`grep -c "no rows selected" $test.xls`;

if [ "$havingRows" -lt 1 ]; then
#mailx -s "this is a test" test@test.com <$test.txt
ux2dos $test.xls | uuencode test.xls | mailx -m -s "This is a test" test@test.com
fi
# 4  
Old 09-05-2007
Use spool+oracle can only generate a CSV file,it's not a real excel file
# 5  
Old 09-05-2007
Send email with attachment in form of excel in unix

Even in .csv file i am facing the problem. Can u please tell me how to resolve it ?
# 6  
Old 09-05-2007
If you want to export a 'real' excel file, I think the better way is use perl script.
and remenber include the Spreadsheet:WriteExcel mod.
# 7  
Old 09-05-2007
Actually I need to use a .sh file only. And csv file is good enough for me. But even in csv the data is not coming up properly. Can you please suggest and solutions for this ?
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

Send email attachment using Operating System Script(UNIX) in Oracle Alerts

Good Day Kindly assist: I am creating an Alert that will notify supervisors of staff members who are due for probation report. I am using Operating System Script(Unix) as source.I have already developed the script. Now the challenge is if there are 3 employee records then the alert... (2 Replies)
Discussion started by: nosi27
2 Replies

2. Shell Programming and Scripting

Not able to send attachment with the email

Hi All, The below code is working fine for me. mailx -s hello abc@xyz.com <<EOT Hello !!! How are you? Regards Rahul EOT But i am not able to send csv file with the mail .Getting just themail but not the attachment. uuencode /path/s1.csv | mailx -s hello abc@xyz.com <<EOT... (9 Replies)
Discussion started by: rafa_fed2
9 Replies

3. Shell Programming and Scripting

Send a file through email using cron as an attachment

Hi All, I want to send a file as an attachment through cron job.Is this possible using cronjob nd if it i, can you please let me know how to do this? Thanks (2 Replies)
Discussion started by: NARESH1302
2 Replies

4. UNIX for Advanced & Expert Users

How to send email as HTML format with attachment ?

hi.. Could somebody help me how to sent an attachment using sendmail command and the content is HTML format ?. Below is my code to sent the email as HTML but i do not know how to sent the attachment, please help me To: "BAHARIN HASAN"<baharin.hasan@gmail.com> from: "DATAONE SDN... (4 Replies)
Discussion started by: bh_hensem
4 Replies

5. UNIX for Dummies Questions & Answers

How to send email attachment as read only in Linux

Hi, Could anyone help me to find soultion for the issue to send email attachment as read only. I can change the file permission in Linux and can send the email attachment from Linux. But my requirment is user can read the attachment but should not modified it . even user save the attachment... (4 Replies)
Discussion started by: calagar
4 Replies

6. Shell Programming and Scripting

unable to send an email attachment

i know its pretty repeated query, but i need to post it in this new thread coz i need it urgently uuencode /var/tmp/chandra/emaillist.txt emaillist.txt | mail -s "message with encoded attachment" am unable to send the attachment emaillist.txt present in the path /var/tmp/chandra/ Is... (11 Replies)
Discussion started by: cmaroju
11 Replies

7. AIX

Send email from unix (AIX) with PDF attachment

I am using the following command to send PDF attachment with a mail. uuencode <attachment.pdf> <attachment.pdf>|mailx -s <subject> <mail_id> < <Message_file.txt> This one send the message with attachment. I would like send PDF attachment with the mail Can any one help with this issue ? ... (0 Replies)
Discussion started by: sunjup
0 Replies

8. Shell Programming and Scripting

send email from unix with attachment

Hello All, This is a common question that I found lot of results in the forums. I am trying to use uuencode to attach a file and send email. I have no issues sending email, but not able to attach any files using sendmail. Is uuencode part of sendmail or does 'uuencode' utility need to be... (1 Reply)
Discussion started by: chiru_h
1 Replies

9. Shell Programming and Scripting

script that will send and email attachment

I'm looking for a sample of some code that will take the output from a file and generate an email that will include that text as an attachment. the script is in the borne shell. any help? (2 Replies)
Discussion started by: davels
2 Replies

10. UNIX for Advanced & Expert Users

Changing Unix form to Microsoft Word form to be able to email it to someone.

Please someone I need information on how to change a Unix form/document into a microsoft word document in order to be emailed to another company. Please help ASAP. Thankyou :confused: (8 Replies)
Discussion started by: Cheraunm
8 Replies
Login or Register to Ask a Question