title: Export to Excel in ColdFusion
body: <p>I am posting few inputs into a url using cfhttp and expecting to download some data in a xls file. I am trying to do get data using cffile ="write" which doesn't work.  Can any one suggest how can we go with this. Here is the code below</p>
  
  <pre><code>&lt;cfhttp url="#Baseurl#" method="post" result="ExportToExcelresult" redirect="no" resolveurl="true"&gt;
      &lt;cfhttpparam type="header" name="REFERER" value="#Baseurl#" &gt;
      &lt;cfhttpparam type="header" name="Cache-Control" value="no-cache"&gt;
      &lt;cfhttpparam type="header" name="Content-Type" value="application/x-www-form-urlencoded"&gt;
      &lt;cfhttpparam type="header" name="Connection" value="keep-alive" &gt;
      &lt;cfhttpparam type="header" name="User-Agent" value="Mozilla/5.0 (Windows NT 6.1; WOW64; Trident/7.0; rv:11.0) (KHTML, like Gecko) Chrome/27.0.1453.110 Safari/537.36"&gt;
      &lt;cfhttpparam type="header" name="cookie" value="TestCookie=;" encoded="yes"&gt;
  
      &lt;cfloop collection="#CookieList#" item="i"&gt;
              &lt;cfhttpparam type="header" name="cookie" value="#CookieList[i]#" encoded="yes"&gt;
      &lt;/cfloop&gt;
      &lt;cfloop collection="#PostCookieList#" item="i"&gt;
              &lt;cfhttpparam type="header" name="cookie" value="#PostCookieList[i]#" encoded="yes"&gt;
      &lt;/cfloop&gt;
  
      &lt;cfloop collection="#PostDefaultCookieList#" item="i"&gt;
              &lt;cfhttpparam type="header" name="cookie" value="#PostDefaultCookieList[i]#" encoded="yes"&gt;
      &lt;/cfloop&gt;
  
  
      &lt;cfhttpparam name="ToolkitScriptManager1_HiddenField" value="" type="formfield"&gt;
      &lt;cfhttpparam name="LeftNav1_LoginView1_treeView1_ExpandState" value="#EXPANDSTATE#" type="formfield"&gt;
      &lt;cfhttpparam name="LeftNav1_LoginView1_treeView1_SelectedNode" value="#SELECTNODE#" type="formfield"&gt;
      &lt;cfhttpparam name="__EVENTTARGET"  value="" type="formfield"&gt;
      &lt;cfhttpparam name="__EVENTARGUMENT"  value="" type="formfield"&gt;
      &lt;cfhttpparam name="LeftNav1_LoginView1_treeView1_PopulateLog" value="" type="formfield"&gt;
      &lt;cfhttpparam name="__VIEWSTATE"  value="#VIEWSTATE#" type="formfield"&gt;
      &lt;cfhttpparam name="__VIEWSTATEGENERATOR"  value="#VIEWSTATEGENERATOR#" type="formfield"&gt;
      &lt;cfhttpparam name="__EVENTVALIDATION"  value="#EVENTVALIDATION#" type="formfield"&gt;
      &lt;cfhttpparam name="ctl00$MainContent$repMUData$ctl00$btnExport"  value="Export to Excel" type="formfield"&gt;
  &lt;/cfhttp&gt;
  </code></pre>
  
  <p>When I do cfdump here is the the result</p>
  
  <p><a href="https://i.stack.imgur.com/ILkeK.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/ILkeK.png" alt="enter image description here"></a></p>
  
  <p>When I do cfdump that it is giving some binary data. For sure I am getting some data but not sure how to extract the data into xls file
  </p>