Check the Code:
Copy codeThe Code is as follows: <% @ LANGUAGE = "VBSCRIPT" CODEPAGE = "65001" %>
<%
Dim conn, rs, excelFileName
ExcelFileName = Server. MapPath ("Data/test.xls ")
Set conn = Server. CreateObject ("ADODB. Connection ")
Conn. connectionstring = "Provider = Microsoft. jet. oleDb.4.0; Persist Security Info = True; Data Source = "& excelFileName &"; Extended ProPerties = "" Excel 8.0; HDR = Yes; IMEX = 1 "";"
Conn. open ()
Set rs = conn. OpenSchema (20)
%>
<! DOCTYPE html PUBLIC "-// W3C // dtd xhtml 1.0 Transitional // EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<Html xmlns = "http://www.w3.org/1999/xhtml">
<Head>
<Meta http-equiv = "Content-Type" content = "text/html; charset = UTF-8"/>
<Title> Excel operation </title>
</Head>
<Body>
<%
Dim I
Response. write ("Excel table information field: <br/> ------------------------ <br/> ")
For I = 0 to rs. fields. count-1 step 1
Response. write (rs. fields (I). name & "<br/> ")
Next
Response. write ("<br/> name of the table in Excel (Table_Name): <br/> ---------------------- <br/> ")
While not rs. EOF
Response. write (rs ("Table_Name") & "<br/> ")
Rs. movenext
Wend
%>
</Body>
</Html>