Solved

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

Posted on 1998-09-28
4
260 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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

Forrester Webinar: xMatters Delivers 261% ROI

Guest speaker Dean Davison, Forrester Principal Consultant, explains how a Fortune 500 communication company using xMatters found these results: Achieved a 261% ROI, Experienced $753,280 in net present value benefits over 3 years and Reduced MTTR by 91% for tier 1 incidents.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Wordpress Only run code if on a certain page 11 47
help thx 6 34
SP result not being displayed 5 69
Secure log in 'box' 4 42
Because your company can’t afford for you to make SEO mistakes, you’ll want to ensure you’re taking the right steps each and every time you post a new piece of content. This list of optimization do’s and don’ts can help you become an SEO wizard.
This article was originally published on Monitis Blog, you can check it here . Today it’s fairly well known that high-performing websites and applications bring in more visitors, higher SEO, and ultimately more sales. By the same token, downtime…
The viewer will learn how to look for a specific file type in a local or remote server directory using PHP.
The viewer will get a basic understanding of what section 508 compliance can entail, learn about skip navigation links, alt text, transcripts, and font size controls.

734 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