Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

download file then run processing

Status
Not open for further replies.

pilg

Programmer
Feb 16, 2001
82
GB
Hi,

I am new to ASP coding and was wondering if it is possible to download an excel file and then extract data and do some formatting then display this back to the user.

What I want is for the user to click a link then the script downloads the file and does some formatting in the background and then display the results.

Any advice would be greatly appreciated.

Cheers.
 
so you want to do something like this...

1.down an excel file
2.run a macro on it for formatting
3. and then display the formatted excel sheet

or

1. need to create an excel file from database data
2.run a macro on it for formatting
3. and then display the formatted excel sheet

??

-DNG
 
Hi,

I need to:

1: download the excel file
2: extract some data from the file
3: display this data as a webpage to the users

I am Ok with extracting data from an access database but does it work the same for excel? will I need to put the data into a database???

Cheers,

Luke.
 
i would suggest doing this...simple and straight forward way...

1. Query the access database to fetch only the data you want to show the user
2. using response.contenttype set to excel, display the results to the user in the excel sheet

does this work for you??

-DNG
 
Hi,

I need to display the information in a webpage.

I need to automate the download of the excel file and then extract data from the excel file to display to the user within the browser as HTML.

thanks in advance,

 
yes it will display on the webpage...here is some sample code to get you started...try it out...

Code:
<%
Dim rs, conn, sql
SET response content type = "application/vnd.ms-excel"
SET rs=server.createobject("adodb.recordset")
set conn= server.createobject0"adodb.connection")

conn.open "your connection string here to connect to access databae"

sql = "your sql statement here"

rs.open sql, conn

if rs.EOF or BOF then
response.write "No records found"
else

do until rs.EOF
'display your records here
rs.movenext
loop

end if

'close all your objects here
%>

-DNG
 
This does not seem to download the excel file? Also you say connection string to access database but I am working off an excel file.

Am I missing something???
 
i was just suggesting you an alternate way...instead of downloading an already existing excel file(i dont know how it is created in the first place) and formatting it...you can create a new excel sheet off of the database and display it in your webpage...if its not ook with you then i will post the code for downloading excel file...

-DNG
 
When you say "download an excel file" do you mean copy the file from the web server to the web browser?

Or do you mean that the excel file is one a third machine that is neither the server nor the browser and you want the server to fetch it from this other location, parse it, then send the results to the browser?

Or something else?
 
Ok,

I do not have direct access to the database. It is a webpage of people in my company and it displays their whereabouts, like a calender. I do not like the fomatting of this page and I would like to include the information on my site.

The whereabouts page allows you to download all of the information into a excel file (So I have the url to download the file). After the file has been downloaded I would like to take all the information I require from the excel file, do some formatting and display the information to the user.

I would like this to be transparent to the user.

The file I need to download is on athird machine, not the server or the client.

Does that make sense?
 
If you want that the user browser machine download this file and then process it then the way to do this is with client-side script rather than ASP.

If you want YOUR web server to take the excel file from THEIR web server and then re-arrange the format then you can do that with server-side ASP.
 
Yes I would like MY webserver to download the file reformat and then display it.

Do you have any clues as to how I go about doing it? Im OK with reformatting etc just not sure how I can automatically download the file and then extract from the excel file?
 
You can use the server-safe version of the xmlhttp object to download the file from their server to your server.

If it is a proper XLS file then you'll need to actually use the excel object to get inside and work on it. This can be a pain if you've never written excel macros or had other reason to learn their concept of cells and rows and ranges of cells. If it is a plain .CSV file then you can just use FSO to operate on it just like any other text file.
 
Sheco, i guess that would be a diffcult task for him. AS you said "pain"...

-DNG
 
Yes it is a .CSV file. Do you have any example code of using the xmlhttp object??
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top