Skip to main content
Inspiring
February 28, 2013
Question

how do I display excel files stored as binary

  • February 28, 2013
  • 1 reply
  • 829 views

I am trying to create a page that gives users the option to view or download excel files stored in SQL Server database as varbinary(max)

I have googled and searched and figured out how  output images that are stored as binary. I have not been successful yet with excel spreadhseets and I want to be able to do pdf. and word also.  Our DBA will not change the datatype. Any help would be awesome.

Thank you - Jim

Code So far:

<cfquery  name="getBinaryXLS" datasource="rapImageTest">

          select scopechange_data, contentType, contractID

         from Contract_ScopeChanges

           where ContractScopeChangeID in (11,12)

</cfquery>

   

   <cfset i = 0>

  

  <table>

 

  <cfoutput query="getBinaryXLS">

 

  <tr>

          <td>#scopechange_data#</td>

        <td><cfset i = i+1>         

       

       

        <cfcontent source="#getBinaryXLS.scopechange_data#" destination="sheet#i#.xls"

        action="write" overwrite="yes"></td></tr></cfoutput>

       

       </cfoutput></table>

This topic has been closed for replies.

1 reply

Inspiring
March 1, 2013

I don't know the answer but I know that ColdFusion has a cfsreadsheet tag.  Maybe you can read the file with that and then output it.