Apr 17, 2013, 1:25 PM
Re: [BillKSmith] Advice on charting data from an existing excel file.
I apologize, I'm new to the forum and I'm still learning how to work the available tools in the site. I thought I had uploaded the attachment.
I have now attached it properly. In the attachment you will notice multiple columns, that's why I wanted to keep the sample script as simple as possible because my intention is to sort the data in the excel file and chart them by region... eg: 'North', 'South' etc ... I have been reading as you have pointed out, and yes I did notice the script did not have a worksheet name. I had mentioned previously that on that particular sample script, whenever I tried adding a worksheet name, it would corrupt the file and would not allow me to open it.
On another note, I've been trying to dig up something more simple, and I found this particular script in some ask for help site. As you see, I managed to name the worksheet, and now I get one worksheet as 'ach' and another as 'chart1'. I am trying to figure out how to rename 'chart1' worksheet and add more worksheets and find a way to reference the chart and to chart it into a particular worksheet. I'm still researching, but this is what I have so far.
my $workbook = Excel::Writer::XLSX->new( 'chart.xlsx' ) or die $!;
my $worksheet = $workbook->add_worksheet( 'ach' );
my $ref = [
[ 'Max.', 'Min.' ],
[ 7, 5 ],
[ 11, 5 ],
[ 9, 2 ],
[ 8, 5 ], ];
$worksheet->write_col( 0, 0, $ref );
my $chart = $workbook->add_chart( type => 'line' );
values => [ 'ach', 1, $#$ref, 0, 0 ],
name => '=ach!$A$1',
values => [ 'ach', 1, $#$ref, 1, 1 ],
name => '=ach!$B$1',