Reply to topic
Create Excel File from Access Database
joelhe


Joined: 02 Sep 2004
Posts: 2
Reply with quote
I have created an ASP application which collects data and stores it in an Access database on the server and generates reports that are viewable on a web site. My customer would like to have the same data in Excel format. Is it possible to automatically create Excel files from data on the server so that they could click on a link or a button and get a file to download. If so, where can I go to learn how to do this?

Thanks in advance - Joel
Josh
Forum Regular

Joined: 01 Apr 2004
Posts: 1031
Location: Felton, Delaware
Reply with quote
in order to accomplish this you'll need to use a component. .NET may be able to handle this, but without us having excel installed on any of the servers im almost positive that that won't work.

Now... on theother hand... if you just have it outputted as a CSV file then have him download that I know that excel by default opens CSV files. That seems to be your best option to me.
NickJushchyshyn


Joined: 10 Sep 2004
Posts: 5
Reply with quote
A workaround would be to create an ASP page that generates an HTML table from the database. Cell/Font formatting is OK, but no content other than the table.

At the beginning of the ASP file (before the table code) add:
<% response.ContentType ="application/x-excel" %>

If the user has IE and Excel installed, the browser will show the table as an Excel file. The user could then use File->Save... to save the file as an XLS and they're all set.

I've done this for a few client sites and it works out great.
If you want to force the Excel file to open in a new window, just be sure to set the target="_blank" tag in the link that leads to the Excel output.

Other variations of the ContentType property allow for output of Word documents, PDF's etc.

Hope this helps.
Have fun.
joelhe


Joined: 02 Sep 2004
Posts: 2
Reply with quote
NickJushchyshyn wrote:
A workaround would be to create an ASP page that generates an HTML table from the database. Cell/Font formatting is OK, but no content other than the table.

At the beginning of the ASP file (before the table code) add:
<% response.ContentType ="application/x-excel" %>



Just what I needed. Worked beautifully. Thanks - Joel
Create Excel File from Access Database
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
All times are GMT  
Page 1 of 1  

  
  
 Reply to topic