Hello
The following code snippet might help you in basic manipulation of the excel sheet
use strict; use Win32::OLE; # write a value in the first empty ro of the first column # an excel workbook containing a sheet called Versions my $projsheet = 'c:\temp\t.xls'; my $val = 123; my $ex = new Win32::OLE 'Excel.Application' or die; eval ("\$ex->Workbooks->Open(\'$projsheet\')") or die; # # find empty row # my $rowcounter = 1; my $rowval = 1; while (($rowval) && ($rowcounter < 1000)) { $rowval = eval "\$ex->Workbooks(1)->Worksheets(\'Versions\' +)->Cells($rowcounter,1)->{Value}" ; $rowcounter++; } $rowcounter--; # # fill in the values in the sheet # eval "\$ex->Workbooks(1)->Worksheets(\'Versions\')->Cells($rowcoun +ter,1)->{Value}= \'$val\'" ; # # save and quit # $ex->Save; $ex->Quit; return 1;
You will further need to do some ad hoc scripting to avoid message boxes generated by Excel. A good starting point is to record the macro in Excel, look at it in VB and then mimic it in perl.
Tabari

In reply to Re: Scripting data extraction from excel files in a directory. by Tabari
in thread Scripting data extraction from excel files in a directory. by ark989

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.