in reply to Tk / Spreadsheet::WriteExcel Charts problem

The add_chart() method is a Workbook method but you are accidentally calling it on a Worksheet object.

Once you have created the chart object you can add it to a Worksheet using the insert_chart() method. Something like the following:

sub analysis { my $EXworkbook = Spreadsheet::WriteExcel->new( "output.xls" ); my $EXworksheet = $EXworkbook->add_worksheet( 'Worksheet1' ); my $chart = $EXworkbook->add_chart( type => 'column', embedded => +1 ); # Insert the chart into the a worksheet. $EXworksheet->insert_chart( 'E2', $chart ); }

Note, you won't be able to create a Workbook object in one sub and populate it in another unless you are careful with the scope of the objects that you are using.

See also the close() section of the WriteExcel docs for further information on the last point.

--
John.