Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Perl > Perl Misc > SpreadSHeet::WriteExcel Error

Reply
Thread Tools

SpreadSHeet::WriteExcel Error

 
 
Rajpreet
Guest
Posts: n/a
 
      07-21-2009
Greetings,

I am trying to generate an excel report using perl. However, I am
getting below error. Below is the sample file and error quote. Can any
one suggest something?

Sample Code:
#!/tools/perl/bin/perl
use Spreadsheet::WriteExcel;

my $logFile;
$logFile ="/users/rajpreet/Perl_Test07012009.xls";
#unlink($logFile);
print ("logfile is $logFile \n");
$workbook = Spreadsheet::WriteExcel->new('$logFile');
print "At the end of file \n";

Error:
Can't open $logFile. It may be in use or protected at /auto/rajpreet/
test.pl line 8
logfile is /rajpreet/Perl_Test07012009.xls
At the end of file

TIA.
 
Reply With Quote
 
 
 
 
C.DeRykus
Guest
Posts: n/a
 
      07-21-2009
On Jul 21, 3:07*am, Rajpreet <(E-Mail Removed)> wrote:
> Greetings,
>
> I am trying to generate an excel report using perl. However, I am
> getting below error. Below is the sample file and error quote. Can any
> one suggest something?
>
> Sample Code:
> #!/tools/perl/bin/perl
> use Spreadsheet::WriteExcel;


# well-written programs always include lines below

use strict;
use warnings;


>
> my $logFile;
> $logFile ="/users/rajpreet/Perl_Test07012009.xls";
> #unlink($logFile);
> print ("logfile is $logFile \n");
> $workbook

* * * * * = Spreadsheet::WriteExcel->new('$logFile');
^^^^^^^^^^^
^^^^^^^^^^^

perldoc perlintro for an explanation of what's
wrong with your quote selection above.

> print "At the end of file \n";
>
> Error:
> Can't open $logFile. It may be in use or protected at /auto/rajpreet/
> test.pl line 8
> logfile is /rajpreet/Perl_Test07012009.xls
> At the end of file
>



 
Reply With Quote
 
 
 
 
Justin C
Guest
Posts: n/a
 
      07-22-2009
On 2009-07-21, Rajpreet <(E-Mail Removed)> wrote:
> Greetings,
>
> I am trying to generate an excel report using perl. However, I am
> getting below error. Below is the sample file and error quote. Can any
> one suggest something?


use warnings;
use strict;

I fixed the error and the code worked for me.

Justin.

--
Justin C, by the sea.
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
ERROR [HY000] [Microsoft][ODBC Microsoft Access Driver]General error Unable to open registry key 'Temporary (volatile) Jet DSN for process 0xffc Thread 0x228 DBC 0x437b94 Jet'. ERROR [IM006] [Microsoft][ODBC Driver Manager] Driver's SQLSetConnectAttr bazzer ASP .Net 0 03-30-2006 03:16 PM
Error connecting to SQLExpress 2005 locally (error: 26 - Error Locating Server/Instance Specified) hfk0 ASP .Net 2 03-27-2006 08:43 PM
ERROR [HY000] [Microsoft][ODBC Microsoft Access Driver]General error Unable to open registry key 'Temporary (volatile) Jet DSN for process 0x8fc Thread 0x934 DBC 0x437b94 Jet'. ERROR [IM006] [Microsoft][ODBC Driver Manager] Driver's SQLSetConnectAttr bazzer ASP .Net 1 03-24-2006 04:20 PM
ERROR [HY000] [Microsoft][ODBC Microsoft Access Driver]General error Unable to open registry key 'Temporary (volatile) Jet DSN for process 0x8fc Thread 0x934 DBC 0x437b94 Jet'. ERROR [IM006] [Microsoft][ODBC Driver Manager] Driver's SQLSetConnectAttr bazzer ASP .Net 0 03-24-2006 02:22 PM
Error 500: ERROR: Cannot forward. Writer or Stream already obtained. Error JavaQueries Java 1 03-01-2005 06:30 PM



Advertisments