Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Perl > Perl Misc > file convesrions

Reply
Thread Tools

file convesrions

 
 
Jack
Guest
Posts: n/a
 
      10-27-2006
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

 
Reply With Quote
 
 
 
 
J. Gleixner
Guest
Posts: n/a
 
      10-27-2006
Jack wrote:
> 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/Sp.../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.
 
Reply With Quote
 
 
 
 
Ben Morrow
Guest
Posts: n/a
 
      10-27-2006

Quoth "Jack" <(E-Mail Removed)>:
> 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

--
I've seen things you people wouldn't believe: attack ships on fire off
the shoulder of Orion; I watched C-beams glitter in the dark near the
Tannhauser Gate. All these moments will be lost, in time, like tears in rain.
Time to die. http://www.velocityreviews.com/forums/(E-Mail Removed)
 
Reply With Quote
 
Tad McClellan
Guest
Posts: n/a
 
      10-27-2006
Jack <(E-Mail Removed)> wrote:

> please reply me soon



Hi. How ya doin?


--
Tad McClellan SGML consulting
(E-Mail Removed) Perl programming
Fort Worth, Texas
 
Reply With Quote
 
Tad McClellan
Guest
Posts: n/a
 
      10-27-2006
Jack <(E-Mail Removed)> wrote:

> 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?


--
Tad McClellan SGML consulting
(E-Mail Removed) Perl programming
Fort Worth, Texas
 
Reply With Quote
 
jmcnamara@cpan.org
Guest
Posts: n/a
 
      10-29-2006
Jack wrote:
> 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/Sp...et-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...les/csv2xls.pl

http://search.cpan.org/src/JMCNAMARA...les/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...es/sendmail.pl

John.
--

 
Reply With Quote
 
Martijn Lievaart
Guest
Posts: n/a
 
      10-29-2006
On Fri, 27 Oct 2006 12:37:47 -0700, Jack wrote:

> 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
--
Redundancy is a great way to introduce more single points of failure.

 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Converting JPG file ppt file [Powerpoint] file zxcvar Digital Photography 7 06-22-2009 07:54 PM
How to create MDF file (.mdf) file from XML file. Dave ASP .Net 1 06-07-2007 11:32 PM
file convesrions Jack Perl Misc 0 10-27-2006 09:38 PM
In file parsing, taking the first few characters of a text file after a readfile or streamreader file read... .Net Sports ASP .Net 11 01-17-2006 12:44 AM
An Automated process of watching a network file folder, reading a file in it and deleting the file using ASP.NET ? Luis Esteban Valencia Muņoz ASP .Net 3 06-04-2005 10:56 AM



Advertisments