stallion has asked for the wisdom of the Perl Monks concerning the following question:
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.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Writing into Excel sheet
by CountZero (Bishop) on Jan 15, 2012 at 08:37 UTC |