Beefy Boxes and Bandwidth Generously Provided by pair Networks
No such thing as a small change
 
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 lurking in the Monastery: (9)
As of 2017-12-18 08:18 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    What programming language do you hate the most?




















    Results (473 votes). Check out past polls.

    Notices?