Jump to content

Saving and reading Web page table


MaoMao
 Share

Recommended Posts

Trying to speed up reading Web page use InetRead($Url) and INetGetSource($Url).

When ExcelBookOpen the WebPage.HTML file, got error of missing main.css and calender.css.

Are there work around to ignore the error message?

;$oIE = BinaryToString(InetRead($Url)) ; Ex2 not getting the table

$oIE = _INetGetSource($Url, 'True') ; Ex3 not getting the table

;FileWrite( @WorkingDir & "\"& "WebPage.HTML", _IEBodyReadText ($oIE))

FileWrite( @WorkingDir & "\"& "WebPage.HTML", _IEBodyReadText ($oIE))

$oExcelfile = _ExcelBookOpen(@WorkingDir&"\WebPage.HTML")

Link to comment
Share on other sites

_ExcelWriteFormula question

When writing formula to Excel:

ExcelWriteFormula($oExcelfile, '=SUM(A80:A1800)', 1801, 5)

The Excel table got error in the cell [ #NAME? ]

Details written in the cell become [ =SUM('A80':'A1800') ]

There are four more ( ' )s written in the formular.

What's the solution please help?

Edited by MaoMao
Link to comment
Share on other sites

  • Moderators

Hi, MaoMao. It appears _ExcelWriteFormula favors the R1C1 method. This works for me:

#include <Excel.au3>
$book= _ExcelBookNew()
$form = "=SUM(R1C1:R20C1)"
For $i = 0 To 20
    _ExcelWriteCell($book, $i, $i, 1)
Next

_ExcelWriteFormula($book, $form, 1, 2)

"Profanity is the last vestige of the feeble mind. For the man who cannot express himself forcibly through intellect must do so through shock and awe" - Spencer W. Kimball

How to get your question answered on this forum!

Link to comment
Share on other sites

Thanks. _ExcelWriteFormula works with the R1C1 method! One step ahead! now.

Still finding way to do ExcelBookOpen the WebPage.HTML file, to ignore error of missing main.css and calender.css.

Are there work around to ignore the error message?

Link to comment
Share on other sites

3. All necessary table info is able to store in html format file in seconds with the Inet function.

Then use StringMid to retrieve the body part of html table file content quickly.

Are there good method able to input html table file to array for processing.

Example some of the few thousand recived file record attached for reference.

<table border='0' cellspacing='0' cellpadding="2">
<tr>
<th style="text-align:left">Count</th>
<th style="text-align:left"><a href='/cus/cid.asp?part=243&d=1/19/2012&sort=nameup'><b>Issue</b></a></th>
<th style="text-align:right"><a href='/cus/cid.asp?part=243&d=1/19/2012&sort=holddn'><b>Units</b></a></th>
<th style="text-align:right"><a href='/cus/cid.asp?part=243&d=1/19/2012&sort=valnup'><b>Value</b></a></th>
<th></th>
<th style="text-align:right"><a href='/cus/cid.asp?part=243&d=1/19/2012&sort=stakdn'><b>Stake</b></a></th>
<th style="text-align:right;width:100px"><a href='/cus/cid.asp?part=243&d=1/19/2012&sort=datedn'><b>Date</b></a></th>
<th></th>
</tr>
<tr>
<td>1</td>
<td style="text-align:left">
<a href="csections.asp?issue=229&amp;d=2011-01-17">SECTION A:O</a>
</td>
<td style="text-align:right">9,86,000</td>
<td style="text-align:right">168,418,040</td>
<td></td>
<td style="text-align:right">0.1967%</td>
<td style="text-align:right">17-Jan-2011</td>
<td style="text-align:right"><a href="cday.asp?issue=229&amp;part=243">history</a></td>
</tr>
<tr>
<td>2</td>
<td style="text-align:left">
<a href="csections.asp?issue=42&amp;d=2011-01-17">SECTION B:O</a>
</td>
<td style="text-align:right">1,168,752</td>
<td style="text-align:right">108,386,042</td>
<td></td>
<td style="text-align:right">0.0265%</td>
<td style="text-align:right">17-Jan-2011</td>
<td style="text-align:right"><a href="cday.asp?issue=42&amp;part=243">history</a></td>
</tr>
</tr>
<tr>
<td>1428</td>
<td style="text-align:left">
<a href="csections.asp?issue=5021&amp;d=2012-01-17">SECTION BZ:W</a>
</td>
<td style="text-align:right">0</td>
<td style="text-align:right">0</td>
<td>*</td>
<td style="text-align:right">0.0000%</td>
<td style="text-align:right">2-Jul-2011</td>
<td style="text-align:right"><a href="cday.asp?issue=5021&amp;part=243">history</a></td>
</tr>
</table>
</td>
</tr>
<tr>
<td>
<hr />

Edited by MaoMao
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...