Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:
#use warnings; #use strict; use Cwd; use OLE; use Win32::OLE::Const "Microsoft Excel"; #-----------------------"Copy From" Destination----------------------- +-- my ( $xl_report ) = ( "c:/perl/energy.xls" ); my ( $excel, $workbook, $sheet, $row, @data,$i, $j,$char,$char2,$pri +ntme,$FindMe, @FindMe ); $excel = CreateObject OLE 'Excel.Application'; $excel -> {Visible} = 1; $excel -> {EnableEvents} = "false"; #-----------------------Formating and Setup---------------------- +----- $workbook = $excel -> Workbooks -> Open ( "$xl_report" ) or &te +rminate ( "open $xl_report" ); $sheet = $workbook -> Worksheets( "info" ); $sheet -> Activate; #---------------------Search for Text----------------------------- +--- #print "Find what !?\n"; #$FindMe = <STDIN>;#I also tried multiple types for ($j=1; $j<27; $j++)#loop to go through Columns { $FindMe= findme; $char= chr($j+64); $char2= chr($j+65); for ($i=1; $i<30; $i++)#loop to go through Rows { if (($sheet -> Range ( $char . $i ) -> {Value}) eq $FindMe) { $data = $sheet -> Range ( $char2 . "$i" ) -> {Value}; } } } $sheet -> Range ( "Z" . 1 ) -> {Value} = $data; print "ENDDATA: $data";
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: STDIN Format
by walto (Pilgrim) on Mar 31, 2008 at 18:47 UTC | |
|
Re: STDIN Format
by NetWallah (Canon) on Mar 31, 2008 at 19:24 UTC | |
|
Re: STDIN Format
by tcf03 (Deacon) on Mar 31, 2008 at 18:48 UTC | |
|
Re: STDIN Format
by Anonymous Monk on Apr 01, 2008 at 12:54 UTC |