file convesrions

Discussion in 'Perl Misc' started by Jack, Oct 27, 2006.

  1. Jack

    Jack Guest

    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
     
    Jack, Oct 27, 2006
    #1
    1. Advertising

  2. Jack

    J. Gleixner Guest

    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/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. :)
     
    J. Gleixner, Oct 27, 2006
    #2
    1. Advertising

  3. Jack

    Ben Morrow Guest

    Quoth "Jack" <>:
    > 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.
     
    Ben Morrow, Oct 27, 2006
    #3
  4. Jack <> wrote:

    > please reply me soon



    Hi. How ya doin?


    --
    Tad McClellan SGML consulting
    Perl programming
    Fort Worth, Texas
     
    Tad McClellan, Oct 27, 2006
    #4
  5. 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.



    Did you mean to ask a question?

    What part are you stuck on?


    --
    Tad McClellan SGML consulting
    Perl programming
    Fort Worth, Texas
     
    Tad McClellan, Oct 27, 2006
    #5
  6. Jack

    Guest

    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/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.
    --
     
    , Oct 29, 2006
    #6
  7. 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.
     
    Martijn Lievaart, Oct 29, 2006
    #7
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Luis Esteban Valencia Muñoz
    Replies:
    3
    Views:
    1,442
    Scott Allen
    Jun 4, 2005
  2. Dave
    Replies:
    1
    Views:
    1,031
    Juan T. Llibre
    Jun 8, 2007
  3. =?ISO-8859-2?Q?Miros=B3aw?= Makowiecki

    Reading of file by next of map file and by next of file descriptor.

    =?ISO-8859-2?Q?Miros=B3aw?= Makowiecki, Jul 10, 2007, in forum: C++
    Replies:
    1
    Views:
    820
    Alf P. Steinbach
    Jul 10, 2007
  4. scad
    Replies:
    4
    Views:
    978
    James Kanze
    May 28, 2009
  5. Jack

    file convesrions

    Jack, Oct 27, 2006, in forum: Perl Misc
    Replies:
    0
    Views:
    110
Loading...

Share This Page