in reply to Creating an excel document from hashes

Your question is difficult to understand (for me at least) and I cannot see how the code relates to the question. Do you just want to know how to turn a hash into tabular form? Or is creating an Excel sheet the problem? In any case, a small example of your data (the hash) would be useful to illustrate what you want to achieve.

  • Comment on Re: Creating an excel document from hashes

Replies are listed 'Best First'.
Re^2: Creating an excel document from hashes
by rahulruns (Scribe) on Sep 11, 2013 at 08:10 UTC

    Here is what the hash produces THE OUTPUT IS

    $VAR1 = { 'w' => [ '0', '0', '0.00', '5.50', '0.00', '2.50', '0.00', '489.50', '0.00', '0.00', '0.00', '0.00', '0.00', '242.00', '0.00', '0.00', '0.00', '5.50', '0.00', '4.00',
    I need to convert the hash where one key has multiple values into an excel sheet

      rahulruns:

      You should be able to do it with something like:

      use Spreadsheet::WriteExcel; . . . . code to build hash . . . . my $XL = Spreadsheet::WriteExcel->new('output_file.xls'); my $WS = $XL->add_worksheet('my data'); my ($ROW, $COL) = (0, 0); for my $colname (keys %graph_point_hash) { # Add column header $WS->write_string($ROW, $COL, $colname); # Add column $WS->write_col($ROW+1, $COL, $graph_point_hash{$colname}); # Move on to next column ++$COL; }

      ...roboticus

      When your only tool is a hammer, all problems look like your thumb.