in reply to Excel graphing in perl

For information, you can try perldoc Win32::OLE and Using Win32::OLE and Excel - Tips and Tricks (an excellent node, BTW).

Here's a small example that creates a new workbook, inserts some data and creates a chart on sheet1. Once you get the hang of using OLE, record a macro then generalize, like so (the recorded VBA macro is after __END__):

#!perl use strict; use warnings; use Win32::OLE; use Win32::OLE::Const "Microsoft Excel"; my $xls = Win32::OLE->new('Excel.Application'); $xls->Workbooks->Add(); $xls->{Visible} = -1; $xls->Sheets("Sheet1")->Range('A1')->{Value} = 'Left'; $xls->Sheets("Sheet1")->Range('B1')->{Value} = 'Right'; for (2 .. 5) { $xls->Sheets("Sheet1")->Range("A$_")->{Value} = $_; $xls->Sheets("Sheet1")->Range("B$_")->{Value} = $_ * 2; } $xls->Charts->Add(); $xls->ActiveChart->SetSourceData({ Source =>$xls->Sheets('Sheet1')->Range('A1:B5'), PlotBy =>xlColumns, }); $xls->ActiveChart->Location({ Where => xlLocationAsObject, Name =>'She +et1'}); __END__ Here is the macro I used Sub Macro1() Charts.Add ActiveChart.SetSourceData Source:=Sheets("Sheet1").Range("A1:B5"), + PlotBy:= _ xlRows ActiveChart.Location Where:=xlLocationAsObject, Name:="Sheet1" With ActiveChart .HasTitle = False .Axes(xlCategory, xlPrimary).HasTitle = False .Axes(xlValue, xlPrimary).HasTitle = False End With End Sub

Good luck...