-
Apr 12th, 2021, 11:20 AM
#1
Thread Starter
PowerPoster
get data from html table
based the link:
https://www.codiceinverso.it/elenco-...catastali.html
i need to click on each city and get the list.
for example click on Agrigento and get:
Comune Codice Catastale
AGRIGENTO A089
ALESSANDRIA DELLA ROCCA A181
ARAGONA A351
BIVONA A896
BURGIO B275
CALAMONACI B377
CALTABELLOTTA B427
CAMASTRA B460
CAMMARATA B486
CAMPOBELLO DI LICATA B520
CANICATTI' B602
CASTELTERMINI C275
CASTROFILIPPO C341
CATTOLICA ERACLEA C356
CIANCIANA C668
COMITINI C928
FAVARA D514
GROTTE E209
JOPPOLO GIANCAXIO E390
LAMPEDUSA E LINOSA E431
LICATA E573
LUCCA SICULA E714
MENFI F126
MONTALLEGRO F414
MONTEVAGO F655
NARO F845
PALMA DI MONTECHIARO G282
PORTO EMPEDOCLE F299
RACALMUTO H148
RAFFADALI H159
RAVANUSA H194
REALMONTE H205
RIBERA H269
SAMBUCA DI SICILIA H743
SAN BIAGIO PLATANI H778
SAN GIOVANNI GEMINI H914
SANTA ELISABETTA I185
SANTA MARGHERITA DI BELICE I224
SANT'ANGELO MUXARO I290
SANTO STEFANO QUISQUINA I356
SCIACCA I533
SICULIANA I723
VILLAFRANCA SICULA L944
before to click on Agrigento get Agrigento and the part in ( ), in this case Agrigento - AG
tks for the "hero"!
-
Apr 12th, 2021, 11:37 AM
#2
Re: get data from html table
What have you done so far?
-
Apr 12th, 2021, 11:51 AM
#3
Re: get data from html table
Looks illegal to scrape:
All the contents of this site including without limitation the texts, databases, lists, images, graphics and more are the property of Nomix srl.
The reproduction of the materials contained within the site, by any analog or digital means, is not allowed without the written consent of CodiceInverso.it. Copying and / or printing is permitted for personal and non-commercial use only.
-
Apr 12th, 2021, 12:30 PM
#4
Thread Starter
PowerPoster
Re: get data from html table
Originally Posted by Arnoutdv
What have you done so far?
Code:
Sub test()
Dim oDom As Object: Set oDom = CreateObject("htmlFile")
Dim x As Long, y As Long
Dim oRow As Object, oCell As Object
Dim data
y = 1: x = 1
With CreateObject("msxml2.xmlhttp")
.Open "GET", "https://www.codiceinverso.it/elenco-codici-catastali.html", False
.Send
oDom.body.innerHtml = .responseText
End With
With oDom.getElementsByTagName("table")(0)
ReDim data(1 To .Rows.Length, 1 To .Rows(1).Cells.Length)
For Each oRow In .Rows
For Each oCell In oRow.Cells
data(x, y) = oCell.innerText
y = y + 1
Next oCell
y = 1
x = x + 1
Next oRow
End With
Sheets(1).Cells(1, 1).Resize(UBound(data), UBound(data, 2)).Value = data
End Sub
my old code:-( pooer
-
Apr 12th, 2021, 12:41 PM
#5
Re: get data from html table
But does it work??
What do you expect from us?
-
Apr 12th, 2021, 12:56 PM
#6
Thread Starter
PowerPoster
Re: get data from html table
Originally Posted by Arnoutdv
But does it work??
What do you expect from us?
I dont know the part of code to click on each city and get the related list...
-
Apr 13th, 2021, 01:14 AM
#7
Re: get data from html table
That's Excel-VBA (see that "Sheets(1).Cells-Thingy?)
IIRC, each Cell on a Worksheet has a Hyperlink-Property and an Event FollowHyperlink
Last edited by Zvoni; Tomorrow at 31:69 PM.
----------------------------------------------------------------------------------------
One System to rule them all, One Code to find them,
One IDE to bring them all, and to the Framework bind them,
in the Land of Redmond, where the Windows lie
---------------------------------------------------------------------------------
People call me crazy because i'm jumping out of perfectly fine airplanes.
---------------------------------------------------------------------------------
Code is like a joke: If you have to explain it, it's bad
-
Apr 13th, 2021, 08:22 AM
#8
Re: get data from html table
Originally Posted by Zvoni
That's Excel-VBA (see that "Sheets(1).Cells-Thingy?)
IIRC, each Cell on a Worksheet has a Hyperlink-Property and an Event FollowHyperlink
He's scraping a website and putting it into an Excel spreadsheet.
-tg
-
Apr 14th, 2021, 07:02 PM
#9
Addicted Member
Re: get data from html table
Originally Posted by luca90
I dont know the part of code to click on each city and get the related list...
Check the syslink32 control.
-
Apr 15th, 2021, 02:24 AM
#10
New Member
Re: get data from html table
<!DOCTYPE html>
<html>
<head>
<title>Read Data from HTML Table uisng JavaScript</title>
<style>
table, th, td
{
border: solid 1px #DDD;
border-collapse: collapse;
padding: 2px 3px;
text-align: center;
}
th {
font-weight:bold;
}
</style>
</head>
<body>
<table id="empTable">
<tr>
<th>ID</th>
<th>Employee Name</th>
<th>Age</th>
</tr>
<tr>
<td>01</td>
<td>Alpha</td>
<td>37</td>
</tr>
<tr>
<td>02</td>
<td>Bravo</td>
<td>29</td>
</tr>
</table>
<p><input type="button" id="bt" value="Show Table Data" onclick="showTableData()" /></p>
<p id="info"></p>
</body>
<script>
function showTableData() {
document.getElementById('info').innerHTML = "";
var myTab = document.getElementById('empTable');
// LOOP THROUGH EACH ROW OF THE TABLE AFTER HEADER.
for (i = 1; i < myTab.rows.length; i++) {
// GET THE CELLS COLLECTION OF THE CURRENT ROW.
var objCells = myTab.rows.item(i).cells;
// LOOP THROUGH EACH CELL OF THE CURENT ROW TO READ CELL VALUES.
for (var j = 0; j < objCells.length; j++) {
info.innerHTML = info.innerHTML + ' ' + objCells.item(j).innerHTML;
}
info.innerHTML = info.innerHTML + '<br />'; // ADD A BREAK (TAG).
}
}
</script>
</html>
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|