Read excel files with ado.
- From: noone@xxxxxxx (Reventlov (see signature))
- Date: Thu, 08 Mar 2007 21:14:09 GMT
I'm trying to open an excel file with ado. Can I use a SELECT statement? The script below
says it can't find the sheet1 table (in the line with OPEN). That is the name of the first
sheet in the file.
I want to find a value in column A, retrieve the content of that row and modify a couple
of cells.
With a different script I found that ado cannot find the adox.catalog table object in the
excel file because that property is unsupported for this provider.
It would be fine even if I could read single cells. The search would take more time, but
could be done.
If there is no way to use ADO, I can open it with excel.application (I know how to do it
this way, but I don't want to start the whole application every time for a quick search).
Thank you.
Set oRecordset = createobject("ADODB.Recordset")
Set oConnection = createobject("ADODB.Connection")
oConnection.open "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=list.xls;Extended
properties=Excel 8.0"
oRecordset.ActiveConnection = oConnection
oRecordset.CursorType=1 : oRecordset.LockType=3
SQL = "SELECT * FROM sheet1"
oRecordset.Open SQL, oConnection
--
Giovanni Cenati (Aosta, Italy)
Write to user "Reventlov" and domain at katamail com
http://digilander.libero.it/Cenati (Esempi e programmi in VbScript)
--
.
- Prev by Date: Re: UTF-8 to Latin-1 Conversion
- Next by Date: Re: vbscript ADSI recordset to dictionary problem
- Previous by thread: Focus on Msgbox and Closing App
- Next by thread: Pipe output to variable
- Index(es):
Relevant Pages
|