Récupérer code html des cellules d'un tableau Web vers Excel

ttlan

XLDnaute Nouveau
Bonjour,

J'ai en fichiers les codes source, en html, de tableaux que j'ai fait (dans des pages Web).

Je voudrais récupérer le code html de chacune des cellules de mes tableaux pour mettre ce même code, sous forme de simple texte, en tableur Excel afin de triturer le code html.

Dans chaque cellule, le code html contient des balises html (plusieurs liens hypertextes, plusieurs images, etc. ...)

D'autre part, il peut y avoir des commentaires, sous la forme standard <!-- Ceci est un commentaire --> qu'il faudrait "oublier".

Comment m'y prendre, s'il vous plaît. Il me reste assez peu de cheveux !

Exemple pour travailler dessus : ce tableau fait 3 x 3. Je voudrais récupérer cela dans un tableau Excel similaire (3 * 3) avec juste le code html, tout le code html contenu dans chaque cellule et rien d'autre.

Code:
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">

<html>

<head>
<title>Récup code html d'un tabeau sur une page web dans Excel</title>
</head>

<body>
<table width="600" border="1" cellspacing="2" cellpadding="0">
	<tr>
		<!-- On ignore les commentaires -->
		<td>Ce texte<sup><a title="Bulle d'information" href="#">*</a></sup> contient <font color="maroon"><strong>des balises</strong></font> html<sup><a title="Seconde bulle d'information" href="#">*</a></sup> comme un <a title="Google" href="https://google.fr" target="_blank">lien</a> et une image <img src="http://upload.wikimedia.org/wikipedia/fr/c/cf/Logo_Microsoft_Excel_2013.png" alt="Logo Excel" height="32" width="32" border="0">.</td>
		<td>Ce texte<sup><a title="Bulle d'information" href="#">*</a></sup> contient <font color="maroon"><strong>des balises</strong></font> html<sup><a title="Seconde bulle d'information" href="#">*</a></sup> comme un <a title="Google" href="https://google.fr" target="_blank">lien</a> et une image <img src="http://upload.wikimedia.org/wikipedia/fr/c/cf/Logo_Microsoft_Excel_2013.png" alt="Logo Excel" height="32" width="32" border="0">.</td>
		<td>Ce texte<sup><a title="Bulle d'information" href="#">*</a></sup> contient <font color="maroon"><strong>des balises</strong></font> html<sup><a title="Seconde bulle d'information" href="#">*</a></sup> comme un <a title="Google" href="https://google.fr" target="_blank">lien</a> et une image <img src="http://upload.wikimedia.org/wikipedia/fr/c/cf/Logo_Microsoft_Excel_2013.png" alt="Logo Excel" height="32" width="32" border="0">.</td>
	</tr>
	<tr><!-- Version du 10.02.2015 --><!-- Prochaine version prévue le 11.02.2015 -->
		<td>Ce texte<sup><a title="Bulle d'information" href="#">*</a></sup> contient <font color="maroon"><strong>des balises</strong></font> html<sup><a title="Seconde bulle d'information" href="#">*</a></sup> comme un <a title="Google" href="https://google.fr" target="_blank">lien</a> et une image <img src="http://upload.wikimedia.org/wikipedia/fr/c/cf/Logo_Microsoft_Excel_2013.png" alt="Logo Excel" height="32" width="32" border="0">.</td>
		<td>Ce texte<sup><a title="Bulle d'information" href="#">*</a></sup> contient <font color="maroon"><strong>des balises</strong></font> html<sup><a title="Seconde bulle d'information" href="#">*</a></sup> comme un <a title="Google" href="https://google.fr" target="_blank">lien</a> et une image <img src="http://upload.wikimedia.org/wikipedia/fr/c/cf/Logo_Microsoft_Excel_2013.png" alt="Logo Excel" height="32" width="32" border="0">.</td>
		<td>Ce texte<sup><a title="Bulle d'information" href="#">*</a></sup> contient <font color="maroon"><strong>des balises</strong></font> html<sup><a title="Seconde bulle d'information" href="#">*</a></sup> comme un <a title="Google" href="https://google.fr" target="_blank">lien</a> et une image <img src="http://upload.wikimedia.org/wikipedia/fr/c/cf/Logo_Microsoft_Excel_2013.png" alt="Logo Excel" height="32" width="32" border="0">.</td>
	</tr>
	<tr>
		<td>Ce texte<sup><a title="Bulle d'information" href="#">*</a></sup> contient <font color="maroon"><strong>des balises</strong></font> html<sup><a title="Seconde bulle d'information" href="#">*</a></sup> comme un <a title="Google" href="https://google.fr" target="_blank">lien</a> et une image <img src="http://upload.wikimedia.org/wikipedia/fr/c/cf/Logo_Microsoft_Excel_2013.png" alt="Logo Excel" height="32" width="32" border="0">.</td>
		<!-- Prochaine version prévue le 12.02.2015 -->
		<td>Ce texte<sup><a title="Bulle d'information" href="#">*</a></sup> contient <font color="maroon"><strong>des balises</strong></font> html<sup><a title="Seconde bulle d'information" href="#">*</a></sup> comme un <a title="Google" href="https://google.fr" target="_blank">lien</a> et une image <img src="http://upload.wikimedia.org/wikipedia/fr/c/cf/Logo_Microsoft_Excel_2013.png" alt="Logo Excel" height="32" width="32" border="0">.</td>
		<td>Ce texte<sup><a title="Bulle d'information" href="#">*</a></sup> contient <font color="maroon"><strong>des balises</strong></font> html<sup><a title="Seconde bulle d'information" href="#">*</a></sup> comme un <a title="Google" href="https://google.fr" target="_blank">lien</a> et une image <img src="http://upload.wikimedia.org/wikipedia/fr/c/cf/Logo_Microsoft_Excel_2013.png" alt="Logo Excel" height="32" width="32" border="0">.</td>
	</tr>
</table>
</body>

</html>

Cordialement
 
Dernière édition:

ttlan

XLDnaute Nouveau
Re : Récupérer code html des cellules d'un tableau Web vers Excel

Bonjour Iznogood1,

Merci de contribuer.

Non, ce n'est pas du tout cela que je cherche à obtenir.

Avec votre manipulation, j'obtiens le rendu, par le moteur de rendu du navigateur utilisé par Excel (qui est celui d'Internet Explorer), soit, par exemple, pour la cellule A1 :

Ce texte* contient des balises html* comme un lien et une image .

Or, ce que je souhaite obtenir, c'est le code source sous-jacent, en html, pas le rendu :

Ce texte<sup><a title="Bulle d'information" href="#">*</a></sup> contient <font color="maroon"><strong>des balises</strong></font> html<sup><a title="Seconde bulle d'information" href="#">*</a></sup> comme un <a title="Google" href="https://google.fr" target="_blank">lien</a> et une image <img src="http://upload.wikimedia.org/wikipedia/fr/c/cf/Logo_Microsoft_Excel_2013.png" alt="Logo Excel" height="32" width="32" border="0">.

Cordialement
 
Dernière édition:

GIBI

XLDnaute Impliqué
Re : Récupérer code html des cellules d'un tableau Web vers Excel

Bonjour,

cela serait plus clair avec un vrai exemple.

Si tu veux te servir d'Excel comme d'un éditeur (notepad ou Ultraedit) tu l'ouvre comme un fichier texte (Données/à partir du texte) ou un simple copier/coller dans excel ===> tu obtiens une cellule=un enregistrememt
 

Statistiques des forums

Discussions
312 090
Messages
2 085 210
Membres
102 820
dernier inscrit
SIEG68