"be consistent" | |
PerlMonks |
Pivot data in Excel via Win32Oleby cocl04 (Sexton) |
on Nov 20, 2009 at 22:36 UTC ( [id://808540]=perlquestion: print w/replies, xml ) | Need Help?? |
cocl04 has asked for the wisdom of the Perl Monks concerning the following question: Background: I need to generate a report with pivoted data. My current process selects data from an Oracle query via the DBI module and loads that data into excel. I normally use the Spreadsheet::WriteExcel module however, it does not have pivot capabilities. So, John M. suggested that I use Win32-OLE. i.e.
#select statement
#prepare statement
#execute
#load data into an array reference.
Once I have the data in an array reference, I can assign the data to an array or whatever to load it to excel. At this point, I can’t find any Win32::OLE logic / syntax that provides a clear example of taking queried data with an unknown range and creating a pivot table in excel. All of the examples I find have a pre-determined range for the spreadsheet like the example below: i.e. # Write all the data at once...
# Create a PivotTable for the data...
Using the above logic, is there a way to take the data from my query / DBI and assign it to a value like so “$rng->{Value} = $mydata;” to create a pivot table? With my queried data, my range will change each time. Can you give any tips to get around this? I have worked on this for several days and I cannot find a solution. I wished that Spreadsheet::Write Excel had a pivot solution. Any help or direction will be greatly appreciated.
Back to
Seekers of Perl Wisdom
|
|