Beefy Boxes and Bandwidth Generously Provided by pair Networks
go ahead... be a heretic

Re: Generating an Excel Report

by Trimbach (Curate)
on Mar 02, 2004 at 07:59 UTC ( #333190=note: print w/replies, xml ) Need Help??

in reply to Generating an Excel Report

Or, if you're feeling lazy and your needs are modest, you can just output a tab-delimited text file with a ".xls" extension and Excel will happily open it without complaint. You don't even if to go through the "import" process in Excel; double-clicking the file opens it right up, at least in Excel versions from the last couple of years.

Gary Blackburn
Trained Killer

Replies are listed 'Best First'.
Re: Re: Generating an Excel Report
by ViceRaid (Chaplain) on Mar 02, 2004 at 09:01 UTC
Re: Re: Generating an Excel Report
by delirium (Chaplain) on Mar 02, 2004 at 14:21 UTC
    The naming a file .xls trick has more uses, too.

    You can mark up an HTML table and apply font and centering options, and also formulas, then save it as .xls, and Excel won't complain. See this snippet for a simple example.

    Formulas look like this:

    <td x:num x:fmla="=B2+1"></td>

      If you're on a Win32 platform you can also use Win32::OLE I don't know if it is bulkier or less efficient than Spreadsheet::WriteExcel, but it's what I have used, in the past (well yesterday really).

      This script runs some queries against a SQL Server Database to create the report that is then created and formatted via Win32::OLE. This is really more than you need, but its an example of a report that uses a decent amount of features and gives you an idea of what kind of code is needed to properly format something. Writing your own is more rewarding than gutting this one and making it fit your needs, so please do so if you find this one useful.


Log In?

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://333190]
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others lurking in the Monastery: (3)
As of 2021-09-23 00:10 GMT
Find Nodes?
    Voting Booth?

    No recent polls found