How to read Excel data into a hash

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • thomasw
    New Member
    • May 2010
    • 2

    How to read Excel data into a hash

    I'm trying to read excel data into a hash. Here's my code so far.
    Code:
    foreach my $row (2..3)
    {
     foreach my $col (1..2)
     { 
     # skip empty cells
      next unless defined $Sheet->Cells($row)->{'Value'};
    
     # store the values of each cell in the hash  
      $store[$row][$col] = $Sheet->Cells($row, $col)->{'Value'};
     }
    }
  • thomasw
    New Member
    • May 2010
    • 2

    #2
    or this

    Code:
    foreach my $row (2..3)
    {
     foreach my $col (1..2)
     { 
     # skip empty cells
      next unless defined $Sheet->Cells($row)->{'Value'};
    
     # store the values of each cell in the hash  
      $store[$row] = $Sheet->Cells($row)->{'Value'};
      $store[$col] = $Sheet->Cells($col)->{'Value'};
     }
    }

    Comment

    Working...