Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I download to Excel?

I'd like to go about offering a "download to excel" functionality for several different sets of data available on different parts of my coldfusion website. I'm using coldfusion and would love to use freely available custom tags / libraries that can help me accomplish this instead of coding it all myself from scratch. I've been pointed to cflib.org but am not sure how to get started. Anyone have any ideas, comments, or resources about downloading coldfusion website data to excel?

like image 233
froadie Avatar asked Dec 13 '22 17:12

froadie


1 Answers

An approach that I have used in the past for an intranet with a load of tabular statistical data is to take advantage of the fact that Excel can read HTML.

On pages that I intend to provide Excel links for, I write out the core table as HTML to a file and include a link to that file in the rendered page. You can then serve this page with an .xls extension, use meta headers or even use an intermediary page with CFCONTENT in order to have your browser fire up Excel to display the content.

This approach can be extended for an arbitrary number of tables per page. You would have to write a tag to contain the table which will then take care of writing the file and supplying the download link for all HTML content contained within.

Sorry for the lack of example code. If my description of the process has left you scratching your head then I'll provide some examples for you.

like image 78
Steve Martin Avatar answered Jan 01 '23 15:01

Steve Martin