Is there any library or script for coldfusion that helps to generate the excel of database table data.
Asked
Active
Viewed 73 times
-1
-
Have you looked at the cfspreadsheet tag https://helpx.adobe.com/coldfusion/cfml-reference/coldfusion-tags/tags-r-s/cfspreadsheet.html? – Scott Jibben Oct 17 '17 at 22:32
1 Answers
0
Hope, this will help
<cfoutput>
<cfquery name="getUsers" datasource="stackoverflow">
select * from users
</cfquery>
<cfheader name="Content-Disposition" value="inline; filename=test.xlsx">
<cfcontent type="application/vnd.openxmlformats-officedocument.spreadsheetml.sheet">
<table border="1">
<tr>
<th>firstName</th>
<th>lastName</th>
<th>city</th>
</tr>
<cfloop query="#getUsers#">
<tr>
<td>#firstName#</td>
<td>#lastName#</td>
<td>#city#</td>
</tr>
</cfloop>
</table>
</cfoutput>

jawahar N
- 462
- 2
- 13
-
Welcome to Stack Overflow! Please don't answer just with source code. Try to provide a nice description about how your solution works. See: [How do I write a good answer?](https://stackoverflow.com/help/how-to-answer). Thanks – sɐunıɔןɐqɐp Sep 23 '18 at 11:21
-
That's not an Excel spreadsheet. It's HTML. The html trick is discouraged because it now causes a corrupt file warning in Excel https://stackoverflow.com/questions/940045/how-to-suppress-the-file-corrupt-warning-at-excel-download/ – SOS Sep 24 '18 at 01:17