swetashah23 has asked for the wisdom of the Perl Monks concerning the following question:

Hello, I was wondering whether there is any available example/sample code for obataining a graph from a given excel spreadsheet / comma delimited file using perl! I am geenerating a summary from daily logs and i need to display the results in the graphical format too...
  • Comment on Creating Graphs from an excel or a comma delimited file.

Replies are listed 'Best First'.
Re: Creating Graphs from an excel or a comma delimited file.
by prasadbabu (Prior) on Jun 19, 2006 at 15:46 UTC

    Hi swetashah23,

    Yes, you can generate graph from Excel using Win32::OLE. Here is a sample code which i got from PM and i don't remember the exact node. You can get more such examples by Super Search.

    use strict; use Win32::OLE; use Win32::OLE::Const 'Microsoft Excel'; my $Excel = Win32::OLE->new("Excel.Application"); $Excel->{Visible} = 1; my $Book = $Excel->Workbooks->Add; my $Sheet = $Book->Worksheets(1); my $Range = $Sheet->Range("A2:C7"); $Range->{Value} = [['Delivered', 'En route', 'To be shipped'], [504, 102, 86], [670, 150, 174], [891, 261, 201], [1274, 471, 321], [1563, 536, 241]]; my $Chart = $Excel->Charts->Add; $Chart->{ChartType} = xlAreaStacked; $Chart->SetSourceData({Source => $Range, PlotBy => xlColumns}); $Chart->{HasTitle} = 1; $Chart->ChartTitle->{Text} = "Items delivered, en route and to be ship +ped";

    Prasad

Re: Creating Graphs from an excel or a comma delimited file.
by rblasch (Monk) on Jun 19, 2006 at 17:22 UTC
      Thanks a lot. The GD based articles are very easy to understand. Helped me a lot. Sweta.
Re: Creating Graphs from an excel or a comma delimited file.
by dorward (Curate) on Jun 19, 2006 at 15:39 UTC
Re: Creating Graphs from an excel or a comma delimited file.
by swetashah23 (Initiate) on Jun 19, 2006 at 15:53 UTC
    Thanks Prasad.
Re: Creating Graphs from an excel or a comma delimited file.
by swetashah23 (Initiate) on Jun 19, 2006 at 15:54 UTC
    Thanks... that was a big help.. :) Sweta.