Skip to content

Instantly share code, notes, and snippets.

@saviourofdp
Last active November 7, 2017 09:09
Show Gist options
  • Save saviourofdp/4875af02d5be35ec45b30445b7de415a to your computer and use it in GitHub Desktop.
Save saviourofdp/4875af02d5be35ec45b30445b7de415a to your computer and use it in GitHub Desktop.
Using HTML Table as a Datasource in VBScript
> cscript ado.vbs

outputs

20

dim ado, rs
set ado = CreateObject("ADODB.Connection")
' also works with the older Jet driver
'ado.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=table.html;Extended Properties=""HTML Import;HDR=NO;"";"
ado.Open "Provider=Microsoft.ACE.OLEDB.12.0;Data Source=table.html;Extended Properties=""HTML Import;HDR=NO;"";"
set rs = ado.Execute("SELECT F2 FROM [table] WHERE F1 = 'Selling Price'")
WScript.Echo rs.GetString(2,,vbTab, vbNewLine)
<html>
<head>
</head>
<body>
<table>
<td data-th="name">Buy</td><td data-th="price">0000</td><tr>
<td data-th="name">Selling Price</td><td data-th="price">20</td><tr>
</table>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment