Hi.
I use a really simple method for outputting to excel.
Hope it helps.
CODE
<cfset dsn = 'frontl_dba'>
<cfquery name="qReport" datasource="#dsn#">
SELECT peo.id peo_id
, peo.forename fName
, peo.surname sName
, peo.dob dob
, SUBSTR(REPLACE(adr.address, CHR(13), ', '), 1, LENGTH(REPLACE(adr.address, CHR(13), ', ')) - 2) as address
, pid.actual_value actVal
FROM cdh_people peo
, mad_addresses adr
, cdh_person_identifiers pid
WHERE peo.id = pid.peo_id
AND adr.adr_id = FUNC_RETURNADRID(peo.id)
AND pid.sou_id = (SELECT sou.id FROM cdh_sources sou WHERE abbr = 'SCN')
AND pid.end_date IS NULL
AND peo.deceased_date IS NULL
AND length(pid.actual_value) < 9
ORDER BY sNAme, fName, dob
</cfquery>
<cfsavecontent variable="report">
<cfoutput>
<table border="1">
<thead align="center">
<th>PEO_ID</th>
<th>Surname</th>
<th>Forename</th>
<th>DOB</th>
<th>Address</th>
<th>SCN Number</th>
</thead>
<cfloop query="qReport">
<tr align="left">
<td>#peo_id#</td>
<td>#sName#</td>
<td>#fName#</td>
<td>#dob#</td>
<td>#address#</td>
<td>#actVal#</td>
</tr>
</cfloop>
</table>
</cfoutput>
</cfsavecontent>
<cffile action="write" file="C:\Reports\8_digit_SCN_#DateFormat(Now(),'ddmmyyyy')#_#LSTimeFormat(Now(),'HHMMSS')#.xls" output="#report#">
This outputs a bordered spreadsheet with the column headers emboldened.