Updated: 06/10/2004


When using databases, it is frequently requested that data is output to a Microsoft Excel spreadsheet. However, this is a particularly difficult task to complete as Excel spreadsheets are a proprietary format, and difficult to create. One way around this is to use COM programming, which takes the backend language (PHP) and uses that to tell Excel itself what to do. Downfalls of this include requiring a Windows web server with Excel installed, a fair chunk of your processing power being used up, and a bug-ridden API. However, there is a light at the end of the tunnel. as Excel versions 2000 and later (or possibly even earlier!) Can accept files written in XML. Now XML is a whole format, too much to explain here, but suffice to say that an XML document is reasonably easy to create, is as good as you make it, and has no special requirements of the server. To this end, the ArrayToExcel class is under development to allow us to create an array (or number of arrays) of objects, and very simply create an Excel spreadsheet that can be opened by any fairly up-to-date version of Excel, and various other spreadsheet packages as well!