Problem with Spreadsheet::Read

Problem with Spreadsheet::Read

am 08.06.2006 10:56:52 von Jim Ford

I want to use the Spreadsheet::Read module to process an Excel
spreadsheet. I'm also a Perl newbie (and have been so for several years!).

Tentative tests have shown it to be working, but I'm getting the
following error:

Use of unitialsised value in hash element at
/usr/local/share/perl/5.8.7/Spreadsheet/Read.pm at line 309.

I've had a look at the offending line:

$data[0]{sheet}{$sheet{label}} = $#data;

I've had a fiddle with the line (I suspected the '$#data'), but I don't
really know what I'm doing and nothing worked!

I'd be grateful for any advice, please.

Jim Ford

Re: Problem with Spreadsheet::Read

am 08.06.2006 15:01:49 von unknown

Jim Ford wrote:

> I want to use the Spreadsheet::Read module to process an Excel
> spreadsheet. I'm also a Perl newbie (and have been so for several years!).
>
> Tentative tests have shown it to be working, but I'm getting the
> following error:
>
> Use of unitialsised value in hash element at
> /usr/local/share/perl/5.8.7/Spreadsheet/Read.pm at line 309.
>
> I've had a look at the offending line:
>
> $data[0]{sheet}{$sheet{label}} = $#data;
>
> I've had a fiddle with the line (I suspected the '$#data'), but I don't
> really know what I'm doing and nothing worked!
>
> I'd be grateful for any advice, please.
>
> Jim Ford

I believe the error means that $sheet{label} is undefined.

Tom Wyant

Re: Problem with Spreadsheet::Read

am 08.06.2006 18:19:25 von Jim Gibson

In article , Jim Ford
wrote:

> I want to use the Spreadsheet::Read module to process an Excel
> spreadsheet. I'm also a Perl newbie (and have been so for several years!).
>
> Tentative tests have shown it to be working, but I'm getting the
> following error:
>
> Use of unitialsised value in hash element at
> /usr/local/share/perl/5.8.7/Spreadsheet/Read.pm at line 309.
>
> I've had a look at the offending line:
>
> $data[0]{sheet}{$sheet{label}} = $#data;
>
> I've had a fiddle with the line (I suspected the '$#data'), but I don't
> really know what I'm doing and nothing worked!
>
> I'd be grateful for any advice, please.

Spreadsheet::Read uses Spreadsheet::ParseExcel to read Excel
spreadsheets. I have used Spreadsheet::ParseExcel successfully in the
past to read Excel spreadsheets. You might try using the
Spreadsheet::ParseExcel module directly and see if that works for you.

Re: Problem with Spreadsheet::Read

am 09.06.2006 18:09:34 von h.m.brand

On Thu, 08 Jun 2006 18:19:25 +0200, Jim Gibson v> =

wrote:

> In article , Jim Ford
> wrote:
>
>> I want to use the Spreadsheet::Read module to process an Excel
>> spreadsheet. I'm also a Perl newbie (and have been so for several =

>> years!).
>>
>> Tentative tests have shown it to be working, but I'm getting the
>> following error:
>>
>> Use of unitialsised value in hash element at
>> /usr/local/share/perl/5.8.7/Spreadsheet/Read.pm at line 309.
>>
>> I've had a look at the offending line:
>>
>> $data[0]{sheet}{$sheet{label}} =3D $#data;
>>
>> I've had a fiddle with the line (I suspected the '$#data'), but I don=
't
>> really know what I'm doing and nothing worked!
>>
>> I'd be grateful for any advice, please.
>
> Spreadsheet::Read uses Spreadsheet::ParseExcel to read Excel
> spreadsheets. I have used Spreadsheet::ParseExcel successfully in the
> past to read Excel spreadsheets. You might try using the
> Spreadsheet::ParseExcel module directly and see if that works for you.=



$#data cannot be undefined I think, but $sheet{label} could be if the sh=
eet
has no label at all (the text in the tab)

You could make that code more safe:

defined $sheet{label} or $data[0]{sheet}{$sheet{label}} =3D $#data;

If the label is undefined, there is no use in storing the reverse
reference. Could you try that?

FWIW I've added that safety check in my local sources,
so it will be in the next release (a bit different)

Enjoy, Have FUN! H.Merijn

Re: Problem with Spreadsheet::Read

am 13.06.2006 10:52:42 von Jim Ford

H.Merijn Brand wrote:
> On Thu, 08 Jun 2006 18:19:25 +0200, Jim Gibson
> wrote:
>
>> In article , Jim Ford
>> wrote:
>>
>>> I want to use the Spreadsheet::Read module to process an Excel
>>> spreadsheet. I'm also a Perl newbie (and have been so for several
>>> years!).
>>>
>>> Tentative tests have shown it to be working, but I'm getting the
>>> following error:
>>>
>>> Use of unitialsised value in hash element at
>>> /usr/local/share/perl/5.8.7/Spreadsheet/Read.pm at line 309.
>>>
>>> I've had a look at the offending line:
>>>
>>> $data[0]{sheet}{$sheet{label}} = $#data;
>>>
>>> I've had a fiddle with the line (I suspected the '$#data'), but I don't
>>> really know what I'm doing and nothing worked!
>>>
>>> I'd be grateful for any advice, please.
>>
>>
>> Spreadsheet::Read uses Spreadsheet::ParseExcel to read Excel
>> spreadsheets. I have used Spreadsheet::ParseExcel successfully in the
>> past to read Excel spreadsheets. You might try using the
>> Spreadsheet::ParseExcel module directly and see if that works for you.
>
>
>
> $#data cannot be undefined I think, but $sheet{label} could be if the sheet
> has no label at all (the text in the tab)
>
> You could make that code more safe:
>
> defined $sheet{label} or $data[0]{sheet}{$sheet{label}} = $#data;
>
> If the label is undefined, there is no use in storing the reverse
> reference. Could you try that?
>
> FWIW I've added that safety check in my local sources,
> so it will be in the next release (a bit different)
>
> Enjoy, Have FUN! H.Merijn

Thanks for the reply.

There are some blank worksheets with the main one, labeled 'Sheet 2'
,'Sheet 3' etc.. I deleted them and the warning went away, but I then
found that I couldn't read the data in a particular cell, even though
the data was there and didn't look unusual (it was read as 'General').
I've gone back to the original version of the spreadsheet and am
ignoring the warning.

Thanks for your help (and responding to my email).

Jim Ford

Re: Problem with Spreadsheet::Read

am 14.06.2006 18:35:13 von h.m.brand

On Tue, 13 Jun 2006 10:52:42 +0200, Jim Ford =

wrote:

> H.Merijn Brand wrote:
>> On Thu, 08 Jun 2006 18:19:25 +0200, Jim Gibson =

>> wrote:
>>>
>>> Spreadsheet::Read uses Spreadsheet::ParseExcel to read Excel
>>> spreadsheets. I have used Spreadsheet::ParseExcel successfully in th=
e
>>> past to read Excel spreadsheets. You might try using the
>>> Spreadsheet::ParseExcel module directly and see if that works for yo=
u.
>> $#data cannot be undefined I think, but $sheet{label} could be if =
=

>> the sheet
>> has no label at all (the text in the tab)
>> You could make that code more safe:
>> defined $sheet{label} or $data[0]{sheet}{$sheet{label}} =3D $#data;
>> If the label is undefined, there is no use in storing the reverse
>> reference. Could you try that?
>> FWIW I've added that safety check in my local sources,
>> so it will be in the next release (a bit different)
>> Enjoy, Have FUN! H.Merijn
>
> Thanks for the reply.
>
> There are some blank worksheets with the main one, labeled 'Sheet 2' =

> ,'Sheet 3' etc.. I deleted them and the warning went away, but I then =
=

> found that I couldn't read the data in a particular cell, even though =
=

> the data was there and didn't look unusual (it was read as 'General').=
=

> I've gone back to the original version of the spreadsheet and am =

> ignoring the warning.
>
> Thanks for your help (and responding to my email).

my $ref =3D ReadData ("file.xls", debug =3D> 9);

could be helpful, as it should print about every action taken, and
every data read.

As I asked in my mail, can I please have that spreadsheet, so I can
analyze?