Linux Hosting
NT/2000 Hosting
DYO Internet Access
JAVASCRIPTez.com
PHPez.com
ASPez.com

Select a Domain
    

Create an Excel File using Only HTML

It's easy to use HTML to create an Excel .xls readable file... The entire file must be an HTML table without the HTML tag, the HEAD tag, and without the BODY tag. Start with >table> and end with </table>. Put in whatever >tr> tags to delimit rows and >td> tags to delimit columns. You can even specify functions within a table cell. Below is a simple example to get you started. <table> <tr><td colspan="2">Absences for the Week</td></tr> <tr><td>Day of Week</td><td>Number of Absences</td></tr> <tr><td>Monday</td><td>1</td></tr> <tr><td>Tuesday</td><td>2</td></tr> <tr><td>Wednesday</td><td>3</td></tr> <tr><td>Thursday</td><td>4</td></tr> <tr><td>Friday</td><td>5</td></tr> <tr><td>Total Absences</td><td>=sum(b3:b7)</td></tr> <tr><td>Average Absences</td><td>=average(b3:b7)</td></tr> </table> Simply save this (without html/head/body) as a .xls file. The browser may prompt you to save or to load the file. Select load and if you have Microsoft Excel on your machine you'll soon see a real spreadsheet. Note that you may find you want a header row as found in the example since otherwise you may have to manual expand each column of cells which by default seem to display for a width matching only your largest numberic size although the SUM or other function may need more digits to display the result.

Of course, you could have simple created this .xls file using Excel. It's likely that the text only nature of this table file may be burdened with less overhead that a real Excel file. But where this becomes useful is as a result of some server side processing. You may use .asp or .php3/4 (or perl, .jps, or .cfm) also but since I don't program in those scripting languages (well, perl a little) I'll only display links to .asp and .php3/4 examples. The server scripting can eith simple create a .xls file after some file or database processing, or it can specify the mime type for Excel and directly display the spreadsheet.

If you also have a website assisting web authors, please feel free to link to either this page or to link to HTMLez.com. If you would like to contribute code to any of the EZ pages referenced on the left, Please email me here. You may also email me if you would like to exchange links (compatible sites only).

cover
Avg. Customer Review:
April 2001
http://www.htmlgoodies.com
cover
Avg. Customer Review:
April 2001
http://www.microsoft.com
cover
Avg. Customer Review:
April 2001
http://www.wrox.com

PHP Copyright Notice