Solved

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

Posted on 1998-09-28
4
256 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
ID: 1855323
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
ID: 1855324
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
ID: 1855325
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
ID: 1855326
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

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Convert html page to a php post email form automatically? 10 66
Wrapper for APPs 9 85
Standard for Web Development 3 47
Wordpress Only run code if on a certain page 11 23
Any business that wants to seriously grow needs to keep the needs and desires of an international audience of their websites in mind. Making a website friendly to international users isn’t prohibitively expensive and can provide an incredible return…
An enjoyable and seamless user experience can go a long way on an eCommerce site. While a cohesive layout and engaging copy play roles in creating a positive user experience, some sites neglect aspects that seem marginal but in actuality prove very …
The viewer will learn how to count occurrences of each item in an array.
This tutorial will teach you the core code needed to finalize the addition of a watermark to your image. The viewer will use a small PHP class to learn and create a watermark.

830 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