How i convert a excel file to csv file

Discussion in 'Perl Misc' started by Santana, Aug 9, 2007.

  1. Santana

    Santana Guest

    Hei friends,
    i'am new in newbie in Perl, and i try i convert a excel file in csv
    file in Suse 10.0 linux.

    I install the Spreadsheet-ParseExcel-0.32.tar.gz module in my linux
    but when i try run this script :

    use strict;
    use Spreadsheet::parseExcel;


    my $excel = Spreadsheet::parseExcel::Workbook->Parse($file);
    foreach my $sheet (@{$excel->{Worksheet}}) {
    printf("Sheet: %s\n", $sheet->{Name});
    $sheet->{MaxRow} ||= $sheet->{MinRow};
    foreach my $row ($sheet->{MinRow} .. $sheet->{MaxRow}) {
    $sheet->{MaxCol} ||= $sheet->{MinCol};
    foreach my $col ($sheet->{MinCol} .. $sheet->{MaxCol}) {
    my $cell = $sheet->{Cells}[$row][$col];
    if ($cell) {
    printf("( %s , %s ) => %s\n", $row, $col, $cell-
    >{Val});

    }
    }
    }
    }



    I have a error something like this :

    "Can´t locate Spreadsheet.pm in @INC(@INC constains : ............"



    Can you help me, please ??

    Thanks,
    Paulito
     
    Santana, Aug 9, 2007
    #1
    1. Advertising

  2. Santana

    Serman D. Guest

    On Aug 9, 9:15 am, Santana <> wrote:
    > I install the Spreadsheet-ParseExcel-0.32.tar.gz module in my linux

    [..]
    > "Can´t locate Spreadsheet.pm in @INC(@INC constains : ............"


    This message means you did not properly install the module, or at
    least, Perl was unable to find it. I install CPAN modules as follows:

    $ perl -wle 'use strict; use Spreadsheet::parseExcel'
    Can't locate Spreadsheet/ParseExcel.pm in @INC (@INC contains: ...)

    $ sudo su -
    # perl -MCPAN -e shell

    cpan[1]> i Spreadsheet::parseExcel
    Strange distribution name [Spreadsheet::parseExcel]
    Module id = Spreadsheet::parseExcel
    DESCRIPTION Get information from Excel file
    CPAN_USERID SZABGAB (Gabor Szabo <>)
    CPAN_VERSION 0.32
    CPAN_FILE S/SZ/SZABGAB/Spreadsheet-ParseExcel-0.32.tar.gz
    DSLIP_STATUS RdpOp (released,developer,perl,object-
    oriented,Standard-Perl)
    INST_FILE (not installed)

    cpan[3]> install Spreadsheet::parseExcel
    Running install for module 'Spreadsheet::parseExcel'
    Running make for S/SZ/SZABGAB/Spreadsheet-ParseExcel-0.32.tar.gz
    [...]

    cpan[4]> quit
    # exit

    $ perl -wle 'use strict; use Spreadsheet::parseExcel'
    $

    Observe that we now did get no output - which means the module was
    properly installed.

    --
    Serman D.
     
    Serman D., Aug 9, 2007
    #2
    1. Advertising

  3. Santana

    Guest

    Santana <> wrote:
    > Hei friends,
    > i'am new in newbie in Perl, and i try i convert a excel file in csv
    > file in Suse 10.0 linux.
    >
    > I install the Spreadsheet-ParseExcel-0.32.tar.gz module in my linux
    > but when i try run this script :
    >
    > use strict;
    > use Spreadsheet::parseExcel;
    >
    > my $excel =3D Spreadsheet::parseExcel::Workbook->Parse($file);


    $file has not been declared.


    > foreach my $sheet (@{$excel->{Worksheet}}) {
    > printf("Sheet: %s\n", $sheet->{Name});
    > $sheet->{MaxRow} ||=3D $sheet->{MinRow};
    > foreach my $row ($sheet->{MinRow} .. $sheet->{MaxRow}) {
    > $sheet->{MaxCol} ||=3D $sheet->{MinCol};
    > foreach my $col ($sheet->{MinCol} .. $sheet->{MaxCol}) {
    > my $cell =3D $sheet->{Cells}[$row][$col];
    > if ($cell) {
    > printf("( %s , %s ) =3D> %s\n", $row, $col, $cell-
    > >{Val});

    > }
    > }
    > }
    > }
    >
    > I have a error something like this :
    >
    > "Can=B4t locate Spreadsheet.pm in @INC(@INC constains : ............"
    >
    > Can you help me, please ??


    If you want actual help, you should post actual code and actual error, not
    "something like" them.

    Perhaps you a have an unnecessary line "use Spreadsheet;" somewhere in your
    code that you are not showing us. If so, take it out.

    Xho

    --
    -------------------- http://NewsReader.Com/ --------------------
    Usenet Newsgroup Service $9.95/Month 30GB
     
    , Aug 9, 2007
    #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. sue yi  Chew

    Using HSSF to convert csv to Excel

    sue yi Chew, Mar 13, 2006, in forum: Java
    Replies:
    1
    Views:
    4,117
    vineet.arora3
    Feb 10, 2011
  2. Michal Mikolajczyk
    Replies:
    0
    Views:
    685
    Michal Mikolajczyk
    Feb 13, 2004
  3. Skip Montanaro
    Replies:
    0
    Views:
    752
    Skip Montanaro
    Feb 13, 2004
  4. Marzena
    Replies:
    7
    Views:
    5,047
    Marzena
    Apr 20, 2008
  5. Santana
    Replies:
    1
    Views:
    134
    Serman D.
    Aug 7, 2007
Loading...

Share This Page