...

View Full Version : Update or coping data into excel sheet.Help needed.



cs168
04-24-2006, 01:04 PM
Hi,
I do have an access database which I use an asp page to add in/ update data into it.
I am now creating an excel sheet to publish the last 25 data in line chart format thru web page. (I mean using IE to open the excel file). My question are:-
a) how can I auto copy the latest 25 data from my db into excel sheets.( I am now doing it manualy).

b) the excel file is always open in anothers window, I think before the transfer it is needed to close the excel sheet.Correct me if I am wrong

Pls help me on this:-
in summary my excel filename is "chart.xls", sheet name "spc"
I can list out the last 25 data as below:-


sql="select top 25 Avg, Range, from tblFiles where mcno = 2 Order by date DESC"

Every time when I update my db I need to transfer the last 25 "avg" and "range" data from my db1.mdb into column a10 to O10 for avg and a11 to o11 for range data. After that save the excel file & then reopen it with the new data page.

I have never deal with excel before, hope that some one can help & guide me thru this.tq.

SpirtOfGrandeur
04-24-2006, 01:23 PM
All you ened to do is in the asp page, change the contenttype into something that is not reconized by browsers, and then set the filename to junk.xls, and it will ask them if they want to open it as an excel file.

Excel will handle the transition from HTML table to Excel table!

ASP:


Response.ContentType = "application/x-download"
Response.AddHeader "content-disposition","attachment; filename=" & fileName & ".xls"

cs168
04-24-2006, 02:10 PM
All you ened to do is in the asp page, change the contenttype into something that is not reconized by browsers, and then set the filename to junk.xls, and it will ask them if they want to open it as an excel file.

Excel will handle the transition from HTML table to Excel table!

ASP:


Response.ContentType = "application/x-download"
Response.AddHeader "content-disposition","attachment; filename=" & fileName & ".xls"
Hi tks for the fast response & help.

I already have the excel file which i am now using it to display my data in line chart format.

what I need is to update the column automatically whenever there is new data being update into access db. This is b'cos I only want to show the latest 25 data to all the user.

How can I copy & paste the data into my excel file thru asp?

tks

SpirtOfGrandeur
04-24-2006, 02:57 PM
You cannot read a file on the userís pc and update it via ASP.

All you can do is recreate the sheet every time which is relatively easy...

cs168
04-24-2006, 04:04 PM
Hi SpirtOfGrandeur,
I maybe not explain it clear. The excel sheet that display are save under server same directory with all my asp page, I display the excel file to user if they click on graph link. I want to automatically copy the latest 25 data from my access db into excel sheet everytime user update the db.
Hope that you have a clearer picture on my problem.tq



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum