ajaykannan has asked for the wisdom of the Perl Monks concerning the following question:

the code is to read the xlsx format file but it showin error like "Can't locate Spreadsheet/Read.pm in @INC (@INC contains: C:/Dwimperl/perl/site/l ib C:/Dwimperl/perl/vendor/lib C:/Dwimperl/perl/lib .) at read_excel.pl line 6. BEGIN failed--compilation aborted at read_excel.pl line 6." But i installed modulue install Spreadsheet::ParseXLSX, install install Spreadsheet::WriteExcel,install OLE::Storage_Lite and still showing error. please help me friends

#!/usr/bin/perl use strict; use warnings; use Spreadsheet::Read qw(ReadData); my $book = ReadData ('simple.xlsx'); say 'A1: ' . $book->[1]{A1}; my @rows = Spreadsheet::Read::rows($book->[1]); foreach my $i (1 .. scalar @rows) { foreach my $j (1 .. scalar @{$rows[$i-1]}) { say chr(64+$i) . " $j " . ($rows[$i-1][$j-1] // ''); } }

Replies are listed 'Best First'.
Re: read from xlsx is throwing error
by Athanasius (Archbishop) on Dec 17, 2016 at 02:56 UTC

    Hello ajaykannan,

    The only problem with the code shown is that you’re using say without first declaring it:

    use feature qw( say );

    Apart from that, your code works fine for me. The error message you report is saying that the Spreadsheet::Read module is not located in any of the directories in @INC. This has nothing to do with Spreadsheet::Read being able to delegate to other modules such as Spreadsheet::ParseXLXS. I suggest you check your paths to ensure that Spreadsheet::Read is installed in a directory listed in @INC. For example, what output do you get from the following one-liner?

    12:52 >perl -MSpreadsheet::Read -wE "say $Spreadsheet::Read::VERSION;" 0.64 12:54 >

    Hope that helps,

    Athanasius <°(((><contra mundum Iustus alius egestas vitae, eros Piratica,

      Can't locate Spreadsheet/Read.pm in @INC (you may need to install the Spreadshee t::Read module) (@INC contains: C:/Strawberry/perl/site/lib C:/Strawberry/perl/v endor/lib C:/Strawberry/perl/lib .). BEGIN failed--compilation aborted. am getting this error

        It seems you are on Windows and in another reply you claim that Spreadsheet::Read is installed.

        Perl thinks it is not installed and it cannot find it in the directories listed. To diagnose whether the files have been installed, run the following and post its output:

        dir /b /s C:\Strawberry\perl\Read.pm

        You should find a file Spreadsheet\Read.pm somewhere there. If not, then Perl is right and you did not install the module.

        To install the module, run:

        C:\Strawberry\perl\bin\cpan Spreadsheet::Read
Re: read from xlsx is throwing error
by soonix (Chancellor) on Dec 17, 2016 at 10:47 UTC
    This message may indicate that Spreadsheet::Read is not installed. DWIM Perl comes with some of the Spreadsheet:: modules, but it seems this one isn't there; and you mentioned installing other modules, but not this one. So probably the simplest solution is cpan install Spreadsheet::Read
     

      it is installed but still getting error. Can you help me please

        How do you know Spreadsheet::Read is installed? did you go and find it somehow? Then where did you find it? Tell us the full path of where you found it. That is about the only way we will believe it is installed. And then, i suspect someone will tell you how to fix your problem; It may be that it was installed into the wrong place and you just need to load it again from cpan. It may be that it would be easiest to use some sort of BEGIN { push @INC,......}. you say it is installed but you need to prove it to us by telling us where you found it.

        Hmmm - mysterious… What message (or error) do you get, if you try to install Spreadsheet::Read again?