This browser does not support basic Web standards, preventing the display of our site's intended design. May we suggest that you upgrade your browser?

Web Development Code Library ASPSimple Excel export

Simple Excel export

This is a really simple technique we've used to export data from a web-based system to an Excel spreadsheet. Since Excel documents are XML-based, simply creating a valid structured HTML page and serving it with the correct MIME header causes Excel to handle the document.

<%Response.ContentType = "application/vnd.ms-excel"%>
<table border="1">
	<tr>
		<td width="26">One</td>
		<td width="75">two</td>
		<td width="77">three</td>
		<td width="339">four</td>
		<td width="77">five</td>
	</tr>
	<tr>s
	  <td>8</td>
	  <td>15</td>
	  <td>25</td>
	  <td>brian</td>
	  <td>23</td>
  </tr>
	<tr>
	  <td>9</td>
	  <td>25</td>
	  <td>22</td>
	  <td>travis</td>
	  <td>33</td>
  </tr>
	<tr>
	  <td>10</td>
	  <td>23</td>
	  <td>55</td>
	  <td>dan</td>
	  <td>22</td>
  </tr>
</table>
Excellence. Our Measure. Our Motto. Our Goal.