Beefy Boxes and Bandwidth Generously Provided by pair Networks
Just another Perl shrine
 
PerlMonks  

Not able to attach and edit Excel file , which helps us to send an email automatically to the end users with attachment..

by kalyanbhave (Initiate)
on Sep 25, 2012 at 10:15 UTC ( #995522=perlquestion: print w/ replies, xml ) Need Help??
kalyanbhave has asked for the wisdom of the Perl Monks concerning the following question:

Hi Monks, I am Not able to attach and edit Excel file , which helps us to send an email automatically to the end users with excel attachment..

#!/usr/bin/perl -w use strict; use warnings; use OLE; use Win32::OLE::Const 'Microsoft Excel'; my $Excel = CreateObject OLE "Excel.Application"; my $Book2 = $Excel->Workbooks->Add(); my $Book3 = $Excel->Workbooks->Open("xxx.xls"); my $Sheet3 = $Book3->Worksheets(1); $Sheet3->Select; $Sheet3->Move("Before" => $Book2->Worksheets(1)); $Book3->Close(0); $Book2->SaveAs({Filename =>"yyy.xls",FileFormat => xlOpenXMLWorkbookMa +croEnabled}); $Book2->Close(); $Excel -> Quit();

Error:- Unrecognized escape \D passed through at eight.pl line 9. Unrecognized escape \D passed through at eight.pl line 14. Can't call method "Worksheets" on an undefined value at eight.pl line 10.

I have downloaded the module Win32-OLE-0.1709.tar.gz , but I am not aware how to proceed it further..

Comment on Not able to attach and edit Excel file , which helps us to send an email automatically to the end users with attachment..
Download Code
Replies are listed 'Best First'.
Re: Not able to attach and edit Excel file , which helps us to send an email automatically to the end users with attachment..
by nemesdani (Friar) on Sep 25, 2012 at 12:33 UTC
    I'm not sure you succeed in opening the xxx.xls in the first place. Try an absolute path instead e.g. "D:\\Work\\Test\\xxx.xls"


    I'm too lazy to be proud of being impatient.

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: perlquestion [id://995522]
Approved by Athanasius
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others romping around the Monastery: (17)
As of 2015-07-30 20:24 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The top three priorities of my open tasks are (in descending order of likelihood to be worked on) ...









    Results (273 votes), past polls