Beefy Boxes and Bandwidth Generously Provided by pair Networks
Don't ask to ask, just ask
 
PerlMonks  

Re: Creating an excel document from hashes

by Ratazong (Monsignor)
on Sep 11, 2013 at 07:19 UTC ( #1053419=note: print w/replies, xml ) Need Help??


in reply to Creating an excel document from hashes

Hi rahulruns!

If you are in a windows environment, you could use Win32::OLE. Your code could look similar to the following:

use Win32::OLE::Const 'Microsoft Excel'; my $Excel = Win32::OLE->new('Excel.Application', 'Quit'); my $book = $Excel->Workbooks->Open($template); my $Sheet = $book->Worksheets($destinationSheet); my $y = 2; foreach my $k (keys %yourHash) { $Sheet->Range("B$y")->{Value} = $k; # title $Sheet->Range("C$y")->{Value} = $yourHash{$k}; # value $y++; }
See Using Win32::OLE and Excel - Tips and Tricks for more information.

HTH, Rata

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1053419]
help
Chatterbox?
and all is quiet...

How do I use this? | Other CB clients
Other Users?
Others perusing the Monastery: (2)
As of 2018-07-19 04:36 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    It has been suggested to rename Perl 6 in order to boost its marketing potential. Which name would you prefer?















    Results (402 votes). Check out past polls.

    Notices?