SpreadSHeet::WriteExcel Error

Discussion in 'Perl Misc' started by Rajpreet, Jul 21, 2009.

  1. Rajpreet

    Rajpreet Guest

    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.
     
    Rajpreet, Jul 21, 2009
    #1
    1. Advertising

  2. Rajpreet

    C.DeRykus Guest

    On Jul 21, 3:07 am, Rajpreet <> 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
    >
     
    C.DeRykus, Jul 21, 2009
    #2
    1. Advertising

  3. Rajpreet

    Justin C Guest

    On 2009-07-21, Rajpreet <> 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.
     
    Justin C, Jul 22, 2009
    #3
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Fabio

    Spreadsheet::WriteExcel

    Fabio, Mar 2, 2004, in forum: Perl
    Replies:
    2
    Views:
    902
    Tom Niesytto
    Mar 4, 2004
  2. Erica
    Replies:
    2
    Views:
    117
    John M. Gamble
    Sep 5, 2003
  3. Sven Jungnickel
    Replies:
    3
    Views:
    217
    John McNamara
    Jul 29, 2004
  4. Zhidian Du
    Replies:
    1
    Views:
    141
    A. Sinan Unur
    Dec 11, 2003
  5. Sean Berry

    Spreadsheet::WriteExcel

    Sean Berry, May 8, 2004, in forum: Perl Misc
    Replies:
    11
    Views:
    272
    Sean Berry
    May 9, 2004
Loading...

Share This Page