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
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |