Click to See Complete Forum and Search --> : Single Excel cell on web page


bea
01-17-2003, 03:51 AM
What I have is:
a price list for 50 products in Excel file prices.xls
and
about 50 html files (product1.html, product2.html,..., product50.html), each of them containing a cell (<td>) with the product price.

What I want is:
when I change prices in xls file, to see changes sort of automatically made in each html file (each html file containing a certain cell from the xls file)

I've already tried:
1 - to insert database results from xls file to html file and saved it as asp file, but I always got the entire pricelist (table column) and I need just a single cell (one price) from the xls file to appear in html file. Even when I defined names for each cell containing the price information it didn't work (looks like it works just for the columns - defining names I mean)
2 - with <!--#include file="prices.xls" --> in html code and saved it as shtm file, but I also got data from the entire table

In both cases it looks to me the only problem is how to tell the html code to read the certain cell from the xls file and not the entire column or table.

I will really appreciate any ideas, thanks in advance and have a nice weekend!

vishu_gupt
01-17-2003, 05:08 AM
HI,
I can suggest you many ways to implement this. One is, you can use database to store the prices and get the value from database to show the thing. But I think you just have few things to display and you want to deal with Excel file so I am suggesting you another way, by which you will be able to show the exact value and there will be not need of excel file. Instead of excel, you have to use one Include file and to update any price, you have to update that... Here is the code.

Use it and tell me if it helps you..



'~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
'Put the below line of code in an .INC file. I am using a Dictonary Object.
'~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
<%
dim objMessageDict
Set objMessageDict = CreateObject("Scripting.Dictionary")
REM: Post a new message.
objMessageDict.Add "Message_ID_1", "Message Value 1"
objMessageDict.Add "Message_ID_2", "Message Value 2"
objMessageDict.Add "Message_ID_3", "Message Value 3"
%>

NOw the code you have to use on ASP page.


'~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
'Use this code on the ASP pages where you want to display the Message based on the ID.
'~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
<%
messageCode=CStr("Message_ID_1")
if objMessageDict.Exists(messageCode) then messageDescription = objMessageDict.Item(messageCode)
Response.Write messageDescription
%>

bea
01-17-2003, 07:01 AM
Thanks Vishal Gupta,

it works, it's just that there has to be the xls file, which is also available on the web for those who want to download and print the whole pricelist. In case you proposed I have to update the pricelist twice (first the .xls and then the .inc file). Is there a way to use a similar code you gave me, but to have the xls (or .csv or ...?) file instead of .inc file as a source file (excuse me, if I'm talking nonsense) ?

Thanks again

vishu_gupt
01-19-2003, 10:57 PM
Originally posted by bea
it's just that there has to be the xls file, which is also available on the web for those who want to download and print the whole pricelist. In case you proposed I have to update the pricelist twice (first the .xls and then the .inc file). Is there a way to use a similar code you gave me, but to have the xls (or .csv or ...?) file instead of .inc file as a source file (excuse me, if I'm talking nonsense) ?

Thanks again
If you want to use .xls file just to display it on web so that user can PRINT it or DOWNLOAD it (i am assuming that user just can view it or print it, they can not update it), then same approach will work. You can show the prices in XLS format on web from the INC file using ASP and Request.ContentType should be EXcel type. You can find this code easily on any site.