Solved

Need to create a .CSV file from ASP...

Posted on 1998-09-28
4
248 Views
Last Modified: 2013-12-25
I want the user to click on a link that is of file type .csv, so that Excel or whatever program they have registered to read comma seperated values gets invoked.  I need ASP to create this file.  But a .CSV file won't get executed as ASP.  So basically how can I get either an ASP file passed back as .CSV, or a .CSV file to be executed as ASP code???

Thank you,
David
0
Comment
Question by:dpinkus
  • 2
  • 2
4 Comments
 
LVL 10

Expert Comment

by:MasseyM
Comment Utility
Can you be more specific?  Can you post what the CSV file will look like?  What will create the CSV file?
0
 

Author Comment

by:dpinkus
Comment Utility
A CSV file looks like this:
"value1","value2","value3", etc.
They can be opened from any application that supports this format, generally Excel.  
For an example, go to:  http://quote.yahoo.com/q?s=YHOO&d=t
Then on the bottom click on "Download Spreadsheet Format".  Depending
on how you are configured, either Excel will be launched (sometimes within
your browser) or you will be prompted to save this file to disk.  
I would like to use an ASP script to create the file, but I don't know how
to send it back as a .csv file instead of an html document...

0
 
LVL 10

Accepted Solution

by:
MasseyM earned 50 total points
Comment Utility
YOu would create the file on the server using what ever you will be using (a program or your scipt) - save it as .csv and then in your ASP script, use this:

response.redirect "physical location of .csv file"

This will send just the csv file to the browser.
0
 

Author Comment

by:dpinkus
Comment Utility
Perhaps I didn't phrase my question correctly.  I do not want to physically write a file, I want to execute an ASP script that returns a stream of data back to the browser, but tells the browser that it is a .csv file.  I solved this by putting the following at the beginning of my ASP script:
<%
Response.ContentType = "application/vnd.ms-excel"
%>

This did cause the desired behaviour, of launching their EXCEL application to view the file.  I suppose there is a MIME combination that I can use above for CSV, but I do not know what it is...
0

Featured Post

Maximize Your Threat Intelligence Reporting

Reporting is one of the most important and least talked about aspects of a world-class threat intelligence program. Here’s how to do it right.

Join & Write a Comment

Popularity Can Be Measured Sometimes we deal with questions of popularity, and we need a way to collect opinions from our clients.  This article shows a simple teaching example of how we might elect a favorite color by letting our clients vote for …
Author Note: Since this E-E article was originally written, years ago, formal testing has come into common use in the world of PHP.  PHPUnit (http://en.wikipedia.org/wiki/PHPUnit) and similar technologies have enjoyed wide adoption, making it possib…
Viewers will get an overview of the benefits and risks of using Bitcoin to accept payments. What Bitcoin is: Legality: Risks: Benefits: Which businesses are best suited?: Other things you should know: How to get started:
This tutorial walks through the best practices in adding a local business to Google Maps including how to properly search for duplicates, marker placement, and inputing business details. Login to your Google Account, then search for "Google Mapmaker…

763 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

9 Experts available now in Live!

Get 1:1 Help Now