How can I get a query to show up in an Excel Spreadsheet??
I have a query result that shows records on a page and I need the page to have a link or button that will bring up the query result in an Excel spreadsheet.
I can get a regular query to work and show an Excel spreadsheet but now I need it where Iam passing a query result to show in Excel Spreadsheet.
Please advise.
I have a query result that shows records on a page and I need the page to have a link or button that will bring up the query result in an Excel spreadsheet.
I can get a regular query to work and show an Excel spreadsheet but now I need it where Iam passing a query result to show in Excel Spreadsheet.
Please advise.
Code:
<cfquery name="myExcel" datasource="theData">
SELECT *
FROM tableOne
</cfquery>
<cfset NewLine = Chr(13) & Chr(10)>
<cfheader name="Content-Disposition" value="attachement;filename=theFile.xls;">
<cfcontent type="application/vnd.ms-excel">
<table border=1 align="left" width="30%">
<tr bgcolor="#c0c0c0">
<th width="10">State</th>
<th width="10">City</th>
<th width="10">County</th>
</tr>
</table>
<cfoutput query="myExcel">
<table border=1 align="left" align="center">
<tr>
<td width="10" valign="top">#state#</td>
<td width="10" valign="top">#city#;</td>
<td width="10" valign="top">#county#</td>
</TABLE>
</cfoutput>