All, I am trying to use the Data::Pivot on data from a query to load it to excel. I load data from my querys a lot using an array reference.
foreach $stmt_from_query (@{$array_ref})
{
$worksheet->write_col(1,0,$array_ref,$format1);
last;
}
However, with the Data-Pivot mod you have to load the data into an array. Once I have the data in an array, I can assign the pivoted data to a no array and then load it to excel.
use Data::Pivot;
@newtable = pivot( table => \@table,
headings => \@headings,
pivot_column => $pivot_col_no,
layout => 'vertical',
row_sum => 'Sum',
row_titles => 1,
format => '%5.2f',
)
I have tried to assign the data in the query to an array. Can someone help me with the syntax to assign the data from an array reference to an array and then use some kind of loop to read the data to a spreadsheet?