title: Include links in exported excel file
body: <p>I am creating a query and then downloading it into an excel document. I would like to include some links inside the excel document but cannot figure out how to do it. I tried just putting an anchor tag in the <code>querySetCell()</code> value, but that just prints the html inside the excel file, the html does not get parsed. I'm using CF10. Below is my code, any advice is appreciated. </p>
  
  <pre><code>&lt;cfset q = queryNew("#columnNames#")&gt;
  
  &lt;cfset queryAddRow(q)&gt;
  &lt;cfset querySetCell(q, "Attributes", "Part Number")&gt;
  &lt;cfset querySetCell(q, "PrimaryPart", "#local.primaryPart.getProductNumber()#")&gt;
  &lt;cfset i = 0&gt;
  &lt;cfloop array="#local.comparableParts#" index="part"&gt;
      &lt;cfset i++&gt;
      &lt;cfset querySetCell(q, "alternatePart"&amp; i, "#part.getPartNumber()#")&gt;
  &lt;/cfloop&gt;
  
  &lt;cfspreadsheet action="write" query="q" filename="partCompare.xls" overwrite="true" /&gt;
  
  &lt;!--- Make a spreadsheet object ---&gt;
  &lt;cfset s = spreadsheetNew()&gt;
  &lt;!--- Add header row ---&gt;
  &lt;cfset spreadsheetAddRow(s, "#columnNames#")&gt;
  &lt;!--- format header ---&gt;    
  &lt;cfset spreadsheetFormatRow(s, {bold=true, fgcolor="lemon_chiffon"}, 1)&gt;
  
  &lt;cfset spreadsheetAddRows(s, q)&gt;
  
  &lt;cfheader name="content-disposition" value="attachment; filename=partCompare.xls"&gt;
  &lt;cfcontent type="application/msexcel" variable="#spreadsheetReadBinary(s)#" reset="true"&gt;
  </code></pre>
  
  <p><br>
  <strong>UPDATE</strong>:
  I made some changes to my code based on the comments. The links do show up in the excel document now, but the 'friendly name' shows as a 0 until I click the 'enable editing' button in excel. It would be nice if the friendly name is displayed from the beginning but if it is not possible, or depends on user settings, this should be fine.</p>
  
  <pre><code>&lt;cfset partCompareQueryObj = queryNew("#columnNames#")&gt;
  
  &lt;cfset queryAddRow(partCompareQueryObj)&gt;
  &lt;cfset querySetCell(partCompareQueryObj, "Attributes", "Part Number")&gt;
  &lt;cfset querySetCell(partCompareQueryObj, "PrimaryPart", "#local.primaryPart.getProductNumber()#")&gt;
  &lt;cfset i = 0&gt;
  &lt;cfloop array="#local.comparableParts#" index="part"&gt;
      &lt;cfset i++&gt;
      &lt;cfset querySetCell(partCompareQueryObj, "alternatePart"&amp; i, "#part.getPartNumber()#")&gt;
  &lt;/cfloop&gt; 
  
  &lt;cfspreadsheet action="write" query="partCompareQueryObj" filename="partCompare.xls" overwrite="true" /&gt;
  
  &lt;!--- Make a spreadsheet object ---&gt;
  &lt;cfset partCompareSpreadSheet = spreadsheetNew()&gt;
  
  &lt;!--- Add header row ---&gt;
  &lt;cfset spreadsheetAddRow(partCompareSpreadSheet, "#columnNames#")&gt;
  &lt;!--- format header ---&gt;    
  &lt;cfset spreadsheetFormatRow(partCompareSpreadSheet, {bold=true, fgcolor="lemon_chiffon"}, 1)&gt;
  
  &lt;cfset spreadsheetAddRows(partCompareSpreadSheet, partCompareQueryObj)&gt;
  
  &lt;cfset SpreadsheetSetCellFormula(partCompareSpreadSheet, 'HYPERLINK("http://www.google.com","#local.primaryPart.getProductNumber()#")', 2, 2)&gt;
  &lt;cfset i = 0&gt;
  &lt;cfloop array="#local.comparableParts#" index="part"&gt;
      &lt;cfset i++&gt;
      &lt;cfset SpreadsheetSetCellFormula(partCompareSpreadSheet, 'HYPERLINK("http://www.google.com","#local.primaryPart.getProductNumber()#")', 2, i+2)&gt;
  &lt;/cfloop&gt;
  
  &lt;cfheader name="content-disposition" value="attachment; filename=partCompare.xls"&gt;
  &lt;cfcontent type="application/msexcel" variable="#spreadsheetReadBinary(partCompareSpreadSheet)#" reset="true"&gt;
  </code></pre>