|
Posted by Mick on May 20, 2008, 7:46 am
Please log in for more thread options
Hi
Which module should I use if I wish to process data in a xls file
using a macro (which also I need to write) to generate graphs for the
data already present in the xls file?
|
|
Posted by Jim Gibson on May 20, 2008, 1:11 pm
Please log in for more thread options
In article
> Hi
>
> Which module should I use if I wish to process data in a xls file
> using a macro (which also I need to write) to generate graphs for the
> data already present in the xls file?
There are (to my knowledge) no Perl modules that will allow you to do
this. On Windows, you can use Win32::OLE to control the Excel
application to do what you want (I have not used it.)
--
Jim Gibson
Posted Via Usenet.com Premium Usenet Newsgroup Services
----------------------------------------------------------
http://www.usenet.com
|
|
Posted by Dirk Van de moortel on June 2, 2008, 2:53 pm
Please log in for more thread options f00d6024-3de1-46b8-92a0-8f41fa619fe1@k1g2000prb.googlegroups.com
> Hi
>
> Which module should I use if I wish to process data in a xls file
> using a macro (which also I need to write) to generate graphs for the
> data already present in the xls file?
Maybe this one will put you on your way:
#=========================
use strict;
use Win32::OLE;
use Win32::OLE::Const 'Microsoft Excel';
print "Opening Excel...\n";
my $Excel = Win32::OLE->new("Excel.Application");
$Excel-> = 1;
my $Book = $Excel->Workbooks->Add;
my $Sheet = $Book->Worksheets(1);
my $Range = $Sheet->Range("A2:C7");
print "Creating data...\n";
$Range-> =
[['Delivered', 'En route', 'To be shipped'],
[504, 102, 86],
[670, 150, 174],
[891, 261, 201],
[1274, 471, 321],
[1563, 536, 241]];
my $Chart = $Excel->Charts->Add;
print "Creating chart...\n";
$Chart-> = xlAreaStacked;
$Chart->SetSourceData({Source => $Range, PlotBy => xlColumns});
$Chart-> = 1;
$Chart->ChartTitle-> = "Items delivered, en route and to be shipped";
print "Saving...\n";
$Book->SaveAs({
FileName => "c:\my documents\perl\excel chart\Excel Chart.xls" ,
FileFormat => xlWorkbookNormal ,
Password => "",
WriteResPassword => "" ,
ReadOnlyRecommended => 0 ,
CreateBackup => 0 }) ;
print "Closing...\n";
$Excel->ActiveWorkbook->Close(0);
print "Quiting...\n";
$Excel->Quit();
#=========================
|
| Similar Threads | Posted | | OLE Module - Need to convert Excel VB Macro to perl | August 3, 2005, 9:06 am |
| writing modules in 'c' | August 27, 2005, 3:18 pm |
| Writing row at a time in Excel using OLE | June 14, 2007, 1:43 pm |
| Reading AND writing Excel spreadsheets | April 30, 2005, 10:05 am |
| flush writing to multiple children IO::Pipe | April 29, 2005, 12:36 pm |
| Writing a HTML/ASP SOAP client for a SOAP::Lite destination | March 16, 2005, 5:19 pm |
| 2 cgi script executions, is it possible? | July 11, 2005, 8:01 pm |
| Script debugging | June 24, 2006, 12:06 am |
| script to calculate CRC-32 of bitstream | December 8, 2004, 5:20 am |
| CGI script (just one) works fine in anything *but* IE | December 18, 2004, 11:47 pm |
|