Hi Monks,

I have an excel file, I need to parse each column into an array so that i can make a statement taking on element from each column with one element from another column and adding preformatted text to it. I have tried Spreadsheet::ParseExcel, but that gave me a mapping of each cell as coordinate of row and column to its value.

. Is there a simple way of doing this?

Regards
Sameet


UPDATE
I am pasting the following code that does the job, but the output is incomplete!

#!/usr/bin/perl use strict; use warnings; use Spreadsheet::ParseExcel; my $xls = Spreadsheet::ParseExcel->new(); my $xls_book = $xls->Parse( 'chrocordinates.xls' ); my $xls_worksheet = $xls_book->{Worksheet}[2]; my @contigs = map { $xls_worksheet->Cell( $_ , 0 )->Value} 1 .. 674; my @coordinates = map {$xls_worksheet->Cell($_, 1)->Value} 1 .. 674; #print "@contigs\n"; print "@coordinates\n"; # When print there are 674 entires my $new_contig; my $new_coordinate; do{ foreach my $contig(@contigs){ $new_coordinate = shift (@coordinates); $new_contig = shift (@contigs); print "$new_coordinate => (chromosome => \'\', contig +=> $new_contig)\n"; } } # prints only 300+ odd entires

How do i get around the probem

Regards
Sameet

In reply to Parsing Excel Columns into arrays by Sameet

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.