Sorry and thanks for the reply CountZero

Im currently learning perl and im trying to make some scripts

I have attached the snippet which wilnt work ..pls rectify my errors..

The format of the document is as follows:

Hi im going to extract from this document and the extraction starts here

1. Check1

Check2

2. Check3

Check4

3. Check5

Check6

The snippet im using is:

$ExcelSheet = getcwd."\\"."Sheet"; $ExcelSheet =~ s/\//\\/g; $Win32::OLE::Warn = 3; my $Excel = Win32::OLE->new('Excel.Application'); $Excel->{Visible} = 0; #0 is hidden, 1 is visible $Excel->{DisplayAlerts}=0; #0 is hide alerts $Excel->{ScreenUpdating} =0; # 0 False my $ExcelReport = $Excel->Workbooks->Open("$ExcelSheet"); my $Sheet=$ExcelReport->Worksheets(2); $Sheet->Activate; @checkfiles=glob('*.doc'); foreach my $file (@checkfiles) { my $document = Win32::OLE -> GetObject("$var"); print "Extracting Text ...\n"; my @array; my $paragraphs = $document->Paragraphs(); my $enumerate = new Win32::OLE::Enum($paragraphs); while(my $paragraph = $enumerate->Next()) { my $text = $paragraph->{Range}->{Text}; $text =~ s/[\n\r\t]//g; $text =~ s/\x0B/\n/g; $text =~ s/\x07//g; chomp $text; my $Data .= $text; @array=split(/\.$/,$Data); foreach my $line( @array) { if($line =~ m/starts here$/)

When "STARTS HERE" is matched the next following lines till the end of the document should be written to the excelsheet("$ExcelSheet")...and i want check1 and check2 to come in one cell and check3 and check4 to come in the next cell and so on.


In reply to Writing into Excel sheet by stallion

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.