List Info

Thread: Excel in Perl




Excel in Perl
country flaguser name
United States
2007-10-18 04:35:39
Hi All,


I want to make an Excel in Perl. However i'm unable to do :

the code I've written is as follows:

my $workbook =
Spreadsheet::WriteExcel->new("perl.xls");
#Create a worksheet.
my $worksheet =
$workbook->add_worksheet('order-ej.csv');
$worksheet->write(0, 0,  "Hi Excel!");
$workbook->close();
}1;


this always fails, and gives an error can't add an undefined
value to
add_worksheet();

Please Reply.


--~--~---------~--~----~------------~-------~--~----~
--
You received this message because you are subscribed to the
Spreadsheet::WriteExcel Google Group.

For posting and other options visit this group at:
http://groups.google.com/group/spreadsheet-writeexcel
?hl=en

You can also post by sending an email to:
http://groups.google.com/group/spreadsheet-writeexcel
?hl=en 

To unsubscribe send an email to
spreadsheet-writeexcel-unsubscribegooglegroups.com
-~----------~----~----~----~------~----~------~--~---


Re: Excel in Perl
country flaguser name
United States
2007-10-18 05:06:04
Nusi wrote:
> Hi All,
> I want to make an Excel in Perl. However i'm unable to
do :
>
> the code I've written is as follows:
>
> my $workbook =
Spreadsheet::WriteExcel->new("perl.xls");
> #Create a worksheet.
> my $worksheet =
$workbook->add_worksheet('order-ej.csv');
> $worksheet->write(0, 0,  "Hi Excel!");
> $workbook->close();
> }1;
>
> this always fails, and gives an error can't add an
undefined value to
> add_worksheet();

Hi,

The snippet that you posted seems to work, at least with the
trailing
"}1" removed. Try this.

    #!/usr/bin/perl -w

    use strict;

    use Spreadsheet::WriteExcel;

    my $workbook  =
Spreadsheet::WriteExcel->new("perl.xls");
    my $worksheet =
$workbook->add_worksheet('order-ej.csv');

    $worksheet->write(0, 0,  "Hi Excel!");
    $workbook->close();



So I guess that you aren't showing the part of the code, or
the
program, that isn't working:

Have a look at the following and try reduce you program down
to a
small complete program that demonstrates the problem.

FAQ: Reporting a bug in Spreadsheet::WriteExcel:
http://groups.google.com
/group/spreadsheet-writeexcel/browse_frm/thread/23c26520737d
753b

John.
--


--~--~---------~--~----~------------~-------~--~----~
--
You received this message because you are subscribed to the
Spreadsheet::WriteExcel Google Group.

For posting and other options visit this group at:
http://groups.google.com/group/spreadsheet-writeexcel
?hl=en

You can also post by sending an email to:
http://groups.google.com/group/spreadsheet-writeexcel
?hl=en 

To unsubscribe send an email to
spreadsheet-writeexcel-unsubscribegooglegroups.com
-~----------~----~----~----~------~----~------~--~---


Re: Excel in Perl
country flaguser name
United States
2007-10-18 05:40:27
Hi ,
This always gives an error like can't open perl.xls. It's in
use or
protected .
Or other than this it gives the error can't add to the
add_worksheet().

Can you tell me what all packages should be added.

Regards.


On Oct 18, 3:06 pm, jmcnamara <jmcnam...cpan.org> wrote:
> Nusi wrote:
> > Hi All,
> > I want to make an Excel in Perl. However i'm
unable to do :
>
> > the code I've written is as follows:
>
> > my $workbook =
Spreadsheet::WriteExcel->new("perl.xls");
> > #Create a worksheet.
> > my $worksheet =
$workbook->add_worksheet('order-ej.csv');
> > $worksheet->write(0, 0,  "Hi
Excel!");
> > $workbook->close();
> > }1;
>
> > this always fails, and gives an error can't add an
undefined value to
> > add_worksheet();
>
> Hi,
>
> The snippet that you posted seems to work, at least
with the trailing
> "}1" removed. Try this.
>
>     #!/usr/bin/perl -w
>
>     use strict;
>
>     use Spreadsheet::WriteExcel;
>
>     my $workbook  =
Spreadsheet::WriteExcel->new("perl.xls");
>     my $worksheet =
$workbook->add_worksheet('order-ej.csv');
>
>     $worksheet->write(0, 0,  "Hi
Excel!");
>     $workbook->close();
>
> So I guess that you aren't showing the part of the
code, or the
> program, that isn't working:
>
> Have a look at the following and try reduce you program
down to a
> small complete program that demonstrates the problem.
>
> FAQ: Reporting a bug in Spreadsheet::WriteExcel:http://groups.google.com/group/spreadshe
et-writeexcel/browse_frm/thre...
>
> John.
> --


--~--~---------~--~----~------------~-------~--~----~
--
You received this message because you are subscribed to the
Spreadsheet::WriteExcel Google Group.

For posting and other options visit this group at:
http://groups.google.com/group/spreadsheet-writeexcel
?hl=en

You can also post by sending an email to:
http://groups.google.com/group/spreadsheet-writeexcel
?hl=en 

To unsubscribe send an email to
spreadsheet-writeexcel-unsubscribegooglegroups.com
-~----------~----~----~----~------~----~------~--~---


Re: Excel in Perl
country flaguser name
United States
2007-10-18 06:32:08


On Oct 18, 11:40 am, Nusi <nusrat_fatim...yahoo.co.in> wrote:
> Hi ,
> This always gives an error like can't open perl.xls.
It's in use or
> protected .
> Or other than this it gives the error can't add to the
> add_worksheet().

Hi,

The error message says "can't open perl.xls. It's in
use or protected"
which generally means:

1. That the file you are trying to create is already open in
Excel.
2. The directory or the file that you are trying to write to
is
protected in some way.

For case 1 you should close the Excel file before trying to
create it
again.
For case 2 you should change the directory/file
permissions.

If you have a further question about this please post the
full error
message.

John.
--


--~--~---------~--~----~------------~-------~--~----~
--
You received this message because you are subscribed to the
Spreadsheet::WriteExcel Google Group.

For posting and other options visit this group at:
http://groups.google.com/group/spreadsheet-writeexcel
?hl=en

You can also post by sending an email to:
http://groups.google.com/group/spreadsheet-writeexcel
?hl=en 

To unsubscribe send an email to
spreadsheet-writeexcel-unsubscribegooglegroups.com
-~----------~----~----~----~------~----~------~--~---


Re: Excel in Perl
country flaguser name
United States
2007-10-18 18:35:02
Maybe after the line 

	my $workbook =
Spreadsheet::WriteExcel->new("perl.xls");

add

	use English qw( -no_match_vars );
	die "Can't create spreadsheet ($OS_ERROR)" unless
$workbook;

And post back the output

-----Original Message-----
From: spreadsheet-writeexcelgooglegroups.com
[mailto:spreadsheet-writeexcelgooglegroups.com] On Behalf
Of Nusi
Sent: Thursday, 18 October 2007 7:36 PM
To: Spreadsheet::WriteExcel
Subject: [Spreadsheet::WriteExcel] Excel in Perl


Hi All,


I want to make an Excel in Perl. However i'm unable to do :

the code I've written is as follows:

my $workbook =
Spreadsheet::WriteExcel->new("perl.xls");
#Create a worksheet.
my $worksheet =
$workbook->add_worksheet('order-ej.csv');
$worksheet->write(0, 0,  "Hi Excel!");
$workbook->close();
}1;


this always fails, and gives an error can't add an undefined
value to
add_worksheet();

Please Reply.





--~--~---------~--~----~------------~-------~--~----~
--
You received this message because you are subscribed to the
Spreadsheet::WriteExcel Google Group.

For posting and other options visit this group at:
http://groups.google.com/group/spreadsheet-writeexcel
?hl=en

You can also post by sending an email to:
http://groups.google.com/group/spreadsheet-writeexcel
?hl=en

To unsubscribe send an email to
spreadsheet-writeexcel-unsubscribegooglegroups.com
-~----------~----~----~----~------~----~------~--~---


[1-5]

about | contact  Other archives ( Real Estate discussion Medical topics )