#use strict; use warnings; use Win32::OLE; use Win32::OLE::Const 'Microsoft Excel'; my $xl = Win32::OLE->new('Excel.Application'); $xl->{Visible} = 0; my $wb = $xl->Workbooks->Add; $bar_data = [ [ "Sam",22], [ "Tom",22], [ "Teddy",22], [ "Tommy",22], [ "Simon",22], ]; $sheet = $wb -> Worksheets(1); $sheet -> Activate; $range_of_data = $wb->ActiveSheet->Range("A1:B5"); $chart = $wb->Charts->Add; $chart->SetSourceData($range_of_data, 2); $chart->{ChartType} = 96; $chart->Location(2, "Sheet2"); $chart->{AutoScaling} = 0; $chart->SeriesCollection(1)->Points(1)->Interior->{Color} = 255; #vbRed $chart->SeriesCollection(1)->Points(2)->Interior->{Color} = 255; #vbRed $chart->PlotArea->{Width} = 1000; $chart->PlotArea->{Height} = 1000; $wb->SaveAs("D:\\Output.xlsx"); $xl-> {DisplayAlerts} = 0; $xl->Quit; $wb = 0; $xl = 0; #### Can't call method "Points" on an undefined value