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

Dear All

Apologies if this is a bit elementary, but how can I read an excel column into an array? Please. and how about if I only wanted a chunk of it not the whole column? I need this urgently, but I will referesh my knowldge this weekend.

Blackadder

janitored by ybiC: Correct typo in title s/coulmn/column

Replies are listed 'Best First'.
Re: Excel column into an array
by Limbic~Region (Chancellor) on Apr 23, 2004 at 12:35 UTC
    blackadder,
    I understand what it is like to be in a hurry, but taking two minutes on CPAN would have turned up Spreadsheet::ParseExcel. TFM is quite friendly.

    Cheers - L~R

    Update: Ok, since I read TFM just to be sure it was possible, here is 1 way to do it:
    #!/usr/bin/perl use strict; use warnings; use Spreadsheet::ParseExcel; my $xls = Spreadsheet::ParseExcel->new(); my $xls_book = $xls->Parse( 'example.xls' ); my $xls_worksheet = $xls_book->{Worksheet}[0]; # B1 - B3 my @vals = map { $xls_worksheet->Cell( $_ , 1 )->Value } 0 .. 2; print "$_\n" for @vals;
      Dear Limbic-Region,
      I wanted to do exactly the same. I just floated the query, and i remembered something like this had happened in the recent past. Thank you very much for the answer.
      regards
      sameet
Re: Excel column into an array
by dragonchild (Archbishop) on Apr 23, 2004 at 12:35 UTC
    Use Spreadsheet::ParseExcel to read the Excel file. After that, it's an exercise for the reader as to how to
    1. Grab the data in the column
    2. Organize that data into an array

    Hint: Spreadsheet::ParseExcel has a function that does this for you.

    ------
    We are the carpenters and bricklayers of the Information Age.

    Then there are Damian modules.... *sigh* ... that's not about being less-lazy -- that's about being on some really good drugs -- you know, there is no spoon. - flyingmoose

    A reply falls below the community's threshold of quality. You may see it by logging in.