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

I am using Strawberry Perl & Getting a blank chart ( excel) . I want to pass a variable for values

$rx=101; $chart->add_series( name => 'HISTOGRAM', categories => '=Sheet1!$A$1:$A$\$rx', ## this works values => '=Sheet1!$B$1:$B$\$rx', ## does not work . get + a blank chart . ); $chart->add_series( categories => [ 'Sheet1', 1, 6, 0, 0 ], values => [ 'Sheet1', 1, 6, 2, 2 ], );
Above does not work. When executed get error "Unknown defined name ARRAY in formula

Replies are listed 'Best First'.
Re: $chart->add_series ERROR
by poj (Abbot) on Apr 20, 2018 at 19:48 UTC
    categories => '=Sheet1!$A$1:$A$\$rx', ## this works

    Are you sure ? I don't see how it can with $rx in single quotes.

    You need to provide a Short, Self-Contained, Correct Example like this

    #!/usr/bin/perl use strict; use Excel::Writer::XLSX; my $workbook = Excel::Writer::XLSX->new( 'c:/temp/chart.xlsx' ); my $worksheet = $workbook->add_worksheet(); $worksheet->write_col( 0, 0,[ 'aa'..'zz' ] ); $worksheet->write_col( 0, 1,[ 1..26*26] ); my $chart = $workbook->add_chart( type => 'column' ); my $rx = 101; $chart->add_series( name => 'HISTOGRAM', categories => '=Sheet1!$A$1:$A$'.$rx, values => '=Sheet1!$B$1:$B$'.$rx, );
    poj