bobdole has asked for the wisdom of the Perl Monks concerning the following question:

I have a tk gui that takes information from the user and then creates and inserts it into an excel file. What I would like to be able to do is have a button after its completed that when clicked on will open the actual excel file viewable for the end user. I have looked around and can't find anything that seems to do what I need so if someone could point me in the right direction that would be great, thanks.

Replies are listed 'Best First'.
Re: Open viewable excel file
by liverpole (Monsignor) on Oct 19, 2007 at 22:38 UTC
    Hi bobdole,

    Very easy to do -- just use the Windows "start" command:

    use strict; use warnings; # Code to create Excel spreadsheet goes here # Spreadsheet will be in variable $fname # ... # Now open the spreadsheet open_spreadsheet($fname); sub open_spreadsheet { my ($fname) = @_; system("start Excel \"$fname\""); }

    s''(q.S:$/9=(T1';s;(..)(..);$..=substr+crypt($1,$2),2,3;eg;print$..$/
      Awesome, thanks a lot. Knew it was probably something straightforward but couldn't find it for the life of me.
Re: Open viewable excel file
by shmem (Chancellor) on Oct 19, 2007 at 22:42 UTC
    You are writing the excel file to disk after editing, aren't you? Bind the button to view the excel file to a subroutine that invokes a command to open that file.

    For Microsoft that is (if I remeber well) system "start \"$excelfile\""; on unixes you might be able to use system "oocalc '$excelfile'" (or applix instead of oocalc, or ..., whatever).

    --shmem

    _($_=" "x(1<<5)."?\n".q·/)Oo.  G°\        /
                                  /\_¯/(q    /
    ----------------------------  \__(m.====·.(_("always off the crowd"))."·
    ");sub _{s./.($e="'Itrs `mnsgdq Gdbj O`qkdq")=~y/"-y/#-z/;$e.e && print}