sententia
Home    Blog

CfSpreadsheet Samples

You also need to set the content
<cfcontent type="application/vnd.ms-excel">

This will automatically put in the headers in the first line.
<!--- Get data --->
<cfquery name="ArtOrders">
SELECT orderid, customerfirstname, customerlastname, total
FROM orders
ORDER BY orderid
</cfquery>

<!--- Save it --->
<cfspreadsheet action="write"
    query="ArtOrders"
    filename="Orders.xls"
    overwrite="true">