Reading Excel file with VBscript 
Author Message
 Reading Excel file with VBscript

Hi.

How can I open Excel file for reading with VBScript and act as database?
I have a dynamical site with everyday xls file upload which has to be
processed. I cannot use ODBC DSN for Excel file driver because the name of
the file consists of current date. For example today's file name would be
"24012000.xls".

How could I still open this file and process it as a database?

Thank you for helping,
    Borut Zagar



Sat, 13 Jul 2002 03:00:00 GMT  
 Reading Excel file with VBscript
Have a look into the WSH Bazaar. There is a sample dealing with Excel and
how to
read a CSV file - it is similar to open an XLS file.

Regards

G. Born

check out the WSH Bazaar at:

http://ourworld.compuserve.com/homepages/Guenter_Born/index0.htm

Borut Zagar schrieb in Nachricht ...

Quote:
>Hi.

>How can I open Excel file for reading with VBscript and act as database?
>I have a dynamical site with everyday xls file upload which has to be
>processed. I cannot use ODBC DSN for Excel file driver because the name of
>the file consists of current date. For example today's file name would be
>"24012000.xls".

>How could I still open this file and process it as a database?

>Thank you for helping,
>    Borut Zagar



Sat, 13 Jul 2002 03:00:00 GMT  
 Reading Excel file with VBscript
Build the filename in your ASP and use a DSN-less connection:

<HTML>
<HEAD>
<TITLE>Test</TITLE>
</HEAD>
<BODY>
<H1>XLS Test</H1>
<TABLE><%

   '*** Build XLS filename here ***
   xlsName = "24012000.xls"
   '*******************************

   Set xls = CreateObject("ADODB.Connection")
   xls.Open "DRIVER={Microsoft Excel Driver (*.xls)}; DBQ=" & _
            server.mappath(xlsName)

   Set rs = CreateObject("ADODB.Recordset")
   rs.Open "DataSource", xls

   Do Until rs.EOF
%>
   <TR>
      <TD><%= rs.Fields("Field1").Value %></TD>
      <TD><%= rs.Fields("Field2").Value %></TD>
      <TD><%= rs.Fields("Field3").Value %></TD>
      <TD><%= rs.Fields("Field4").Value %></TD>
   </TR><%
      rs.MoveNext
   Loop

   rs.Close : Set rs = Nothing
   xls.Close : Set xls = Nothing
%>
</TABLE>
</BODY>
</HTML>

=-=-=
Steve
-=-=-


Quote:
> Hi.

> How can I open Excel file for reading with VBscript and act as database?
> I have a dynamical site with everyday xls file upload which has to be
> processed. I cannot use ODBC DSN for Excel file driver because the name of
> the file consists of current date. For example today's file name would be
> "24012000.xls".

> How could I still open this file and process it as a database?

> Thank you for helping,
>     Borut Zagar



Sat, 13 Jul 2002 03:00:00 GMT  
 
 [ 3 post ] 

 Relevant Pages 

1. Reading Excel file using VBScript

2. Reading Excel file with VBscript

3. Reading Excel file with VBscript

4. vbscript reading excel file

5. read excel file in access 2000 lire fichier excel dans access 2000

6. Reading Excel files without opening excel

7. Read Excel Spreadsheet in VBScript using ADO

8. Read excel with asp/vbscript

9. READING EXCEL CELLS WITH VBSCRIPT

10. Read a Excel file into a Html page?

11. Reading from Excel to text file

12. Reading an Excel file

 

 
Powered by phpBB® Forum Software