<%@Language=VBScript %> Displaying An Excel Spreadsheet in an Web Page

ASP Table of Contents

<% 'Creates an instance of an Active Server Component Set oConn = Server.CreateObject("ADODB.Connection") 'Connects to the Excel driver and the Excel spreadsheet 'in the directory where the spreadsheet was saved strConn = "Driver={Microsoft Excel Driver (*.xls)}; DBQ=C:\Inetpub\Wwwroot\Tutorial\ASPTOC.xls;" 'Opens the connection to the data store oConn.Open strConn 'Selects the records from the Excel spreadsheet strCmd = "SELECT * from `ASPTOC`" Set oRS = Server.CreateObject("ADODB.Recordset") 'Opens the recordset oRS.Open strCmd, oConn 'Prints the cells and rows in the table Response.Write "
" 'Gets records in spreadsheet as a string and prints them in the table Response.Write oRS.GetString (, , "
", "
", NBSPACE) %>