file convesrions

J

Jack

Hello all

I have a question!!
there is a file with extension dat (ie *.dat) in my
unix environment and i wanted to change this to .xls format i mean i
have to transfer this file to an excel sheet and then i need to send
this file as an attachment to an email address and all this should be
done in perl....please reply me soon

regards,
jack
 
J

J. Gleixner

Jack said:
Hello all

I have a question!!

I have an answer.
there is a file with extension dat (ie *.dat) in my
unix environment and i wanted to change this to .xls format i mean i
have to transfer this file to an excel sheet

You have to convert some file to an Excel spread sheet?

Open the file, parse what you want out of it, then write it using
Spreadsheet::WriteExcel.

http://search.cpan.org/~jmcnamara/Spreadsheet-WriteExcel-2.17/lib/Spreadsheet/WriteExcel.pm
and then i need to send
this file as an attachment to an email address

There are a lot of modules on CPAN to mail attachments. Give it a try:

http://search.cpan.org
and all this should be done in perl....

Hence the post to comp.lang.perl.misc. Why not write it in a language
you know?
please reply me soon

No thanks, I'll just post a response when I feel like it. :)
 
B

Ben Morrow

Quoth "Jack said:
there is a file with extension dat (ie *.dat)

What the file's extension is is irrelevant. What matters is the format
of the data inside the file. .dat is commonly used for many different
file formats. If you can tell us what the format is, we may be able to
help you read it in Perl.
in my
unix environment and i wanted to change this to .xls format i mean i
have to transfer this file to an excel sheet

When you want to do something complicated in Perl, first try looking at
http://search.cpan.org . Searching for 'excel' gives, on the first page
of results, the modules Spreadsheet::WriteExcel, for creating Excel
spreadsheets on any machine.
and then i need to send
this file as an attachment to an email address and all this should be
done in perl

I would use the MIME::Lite module for this, though there are other
options.
....please reply me soon

Additions like this are considered rude here, as is writing without
capital letters or punctuation.

Ben
 
T

Tad McClellan

Jack said:
there is a file with extension dat (ie *.dat) in my
unix environment and i wanted to change this to .xls format i mean i
have to transfer this file to an excel sheet and then i need to send
this file as an attachment to an email address and all this should be
done in perl.


Did you mean to ask a question?

What part are you stuck on?
 
J

jmcnamara

Jack said:
there is a file with extension dat (ie *.dat) in my
unix environment and i wanted to change this to .xls format i mean i
have to transfer this file to an excel sheet and then i need to send
this file as an attachment to an email address and all this should be
done in perl

As pointed out above you can create a Excel file with Perl using
Spreadsheet::WriteExcel:

http://search.cpan.org/~jmcnamara/Spreadsheet-WriteExcel/

You didn't say what format the .dat file was but in the distro there
are serveral example programs that will hel get you started. For
example to convert from csv or tab-separated files to Excel:


http://search.cpan.org/src/JMCNAMARA/Spreadsheet-WriteExcel-2.17/examples/csv2xls.pl

http://search.cpan.org/src/JMCNAMARA/Spreadsheet-WriteExcel-2.17/examples/tab2xls.pl

Or how to create and email an Excel file (using Mail::Sender in this
case but there are many other modules):


http://search.cpan.org/src/JMCNAMARA/Spreadsheet-WriteExcel-2.17/examples/sendmail.pl

John.
--
 
M

Martijn Lievaart

Hello all

I have a question!!
there is a file with extension dat (ie *.dat) in my
unix environment and i wanted to change this to .xls format i mean i

I recently accomplished this by writng the file as html, but giving it a
xls extention. Dirty, but it works.
have to transfer this file to an excel sheet and then i need to send
this file as an attachment to an email address and all this should be
done in perl....please reply me soon

Quickest way is to uuencode it and pipe that to a mailer (f.i. mail). No
perl needed.

M4
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,754
Messages
2,569,521
Members
44,995
Latest member
PinupduzSap

Latest Threads

Top