use OLE; $file = 'c:\path\to\file.xls'; if(!-e $file) { print "File does not exist"; exit 0; } $app = CreateObject OLE 'Excel.Application' || die "Can't open EXCEL $ +!\n"; $book = $app->Workbooks->Open($file); $sheet = $book->Worksheets(1); # Retrieve $cellA1 = $sheet->Range("A1")->{'Value'}; $cellB1 = $sheet->Range("B1")->{'Value'}; print "|$cellA1|$cellB1|\n"; # Do pre-processing $sheet->Range("A1")->{'Value'} = 'pre'; $sheet->Range("B1")->{'Value'} = 'process'; $cellA1 = $sheet->Range("A1")->{'Value'}; $cellB1 = $sheet->Range("B1")->{'Value'}; print "|$cellA1|$cellB1|\n"; $app->{'Visible'} = 1; # USER manual input happens here # You can let them close when done (ctrl-f4 is quick) while($app->ActiveWorkbook) { sleep(1); } # Or you can give them time on time sleep(10); # Close it up if you do time if($app->ActiveWorkbook) { $app->ActiveWorkbook->Close(0); $app->Quit(); } # Do post-processing $app = CreateObject OLE 'Excel.Application' || die "Can't open EXCEL $ +!\n"; $book = $app->Workbooks->Open($file); $sheet = $book->Worksheets(1); # Retrieve $cellA1 = $sheet->Range("A1")->{'Value'}; $cellB1 = $sheet->Range("B1")->{'Value'}; print "|$cellA1|$cellB1|\n"; # Do post-processing work $sheet->Range("A1")->{'Value'} = 'post'; $sheet->Range("B1")->{'Value'} = 'process'; $cellA1 = $sheet->Range("A1")->{'Value'}; $cellB1 = $sheet->Range("B1")->{'Value'}; print "|$cellA1|$cellB1|\n"; $app->save(); $app->ActiveWorkbook->Close(0); $app->Quit(); # ThinMonk (TM)

In reply to Re: Excel on screen by Anonymous Monk
in thread Excel on screen by esr

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.