System Administration

Re: How to send output of a perl program to Excel

 
Jeff Picton
Regular Advisor

How to send output of a perl program to Excel

This is really a programming problem. I have a CGI script which outputs statistics to the web-server in tabular form.

Does anybody know how may I pass this data to the input of MS Excel without the obvious cut/paste method ?
7 REPLIES 7
Steven Gillard_2
Honored Contributor

Re: How to send output of a perl program to Excel

Why not just output the data comma-separated to a .csv file? Excel will read these files in without a problem.

Regards,
Steve
Jeff Picton
Regular Advisor

Re: How to send output of a perl program to Excel

Hi

Yes but is it possible to pass the data directly into an Excel file on a Unix Server and displaying this as a graph "on the fly".

I know this is a long shot
Stanimir
Trusted Contributor

Re: How to send output of a perl program to Excel

I thing, the easy way to do this, is
to correct CGI-script in order to
send tab-data in paralel way either to
HTML-form and to file,which could be
opened by EXCEL.

Regards, Stan
H.Merijn Brand (procura
Honored Contributor

Re: How to send output of a perl program to Excel

Aiaiaiai. csv with excel is a real pain in the ass. Not the CSV part (just use CSV_XS or if you cannot compile, CSV (the pure perl version)), but the way Excel opens/reads/imports (these are three different operations!) the CSV.

In the US this will not be a big problem, but try to transfer CSV date fields in european (the only logical) format, and Excel will modify it, EVEN IF YOU STRINGIFY THEM. Excel has the opinion, if it /might/ look like a date, the poor exporter will /probably/ have meant to export a - US - date. WRONG!

now make a csv file with european dates, and use the three ways to get them to excel. All methods give a different result: Excel stinks!

Now for the real solution: Spreadsheet-WriteExcel-0.42 (http://search.cpan.org/author/JMCNAMARA/Spreadsheet-WriteExcel-0.42/) which will give you full control :)

Enjoy, have FUN! H.Merijn
Enjoy, Have FUN! H.Merijn
RAC_1
Honored Contributor

Re: How to send output of a perl program to Excel

There was some tool for that. Dont remember the name. Check on porting centre.
There is no substitute to HARDWORK
H.Merijn Brand (procura
Honored Contributor

Re: How to send output of a perl program to Excel

And since my anser and your first reply crossed, do you *need* Excel? Can't you use unix tools to convert the data to graphs?

Imagemagick has a wonderful interface to perl, and can create, making use of graphing modules (http://search.cpan.org/search?query=graph&mode=all would show several, including http://search.cpan.org/author/MCHANG/CGIGraph-0.93/) If you are working with a database, DBD-Chart (http://search.cpan.org/author/DARNOLD/DBD-Chart-0.80/) might be a fun option.

Enjoy, have FUN! H.Merijn
Enjoy, Have FUN! H.Merijn
Rodney Hills
Honored Contributor

Re: How to send output of a perl program to Excel

Option 1)
Run a perl program under windows and use Win32 module to open an OLE connection to Excel and manipulate the spreadsheet through object method calls.

Option 2)
Run a perl program on HPUX to write the output to a MySql database on the HP box. Then on the PC that is running Excel create a DSN entry to the mysql database. You can use MySQl ODBC Connect software on your PC ( see http://www.mysql.com/products/myodbc/ ) to define the connection. Then in Excel access the database.

HTH

-- Rod Hills
There be dragons...