<!--- Don't output anything *not* in CFOUTPUT tags --->
<!--- This makes it easier to deal with whitespace --->
<CFSETTING ENABLECFOUTPUTONLY="Yes">

<!--- Retrieve information about films --->
<CFQUERY DATASOURCE="ows" NAME="GetFilms">
  SELECT MovieTitle, AmountBudgeted
  FROM Films
  ORDER BY MovieTitle
</CFQUERY>

<!--- Set variables for special characters --->
<CFSET TabChar = Chr(9)>            
<CFSET NewLine = Chr(13) & Chr(10)>

<!--- Set the content-type so Excel is invoked --->
<CFCONTENT TYPE="application/msexcel">

<!--- Suggest default filename for spreadsheet --->
<CFHEADER NAME="Content-Disposition" VALUE="filename=FilmBudgets.xls">

<!--- Output the header row, with column names --->
<!--- Put tab between columns, and newline at end --->
<CFOUTPUT>MOVIE TITLE#TabChar#BUDGET#NewLine#</CFOUTPUT>

<!--- Output actual data rows, each on own line --->
<!--- Put tab between columns, and newline at end  --->
<CFLOOP QUERY="GetFilms">
  <CFOUTPUT>#MovieTitle##TabChar##AmountBudgeted##NewLine#</CFOUTPUT>
</CFLOOP>