Data Scraping a Locally Stored HTML File - using Python
<p>I have a big Excel file, and in each cell I have various HTML content containing comments made by a database user. The content in each cell is unique and varying in length. I need to get rid of all HTML syntax/tags so that I can upload this content to a database table.  How can I scrape this data using Python (or Java if there are no answers for Python)? Could you provide a code example?</p>

<p>In a terminal, <code>pip install bs4</code>. Then you can extract the text with python like so:</p>

<pre><code>import bs4

for cell in [
    '&lt;html&gt;The indicator lights on the control cabinet&amp;nbsp;are to be replaced with 24Vdc&amp;nbsp;LED\'s. 3 Red &amp;amp;&amp;nbsp;3 Green.&lt;/html&gt;',
    '&lt;html&gt;&lt;div&gt; &lt;span style=""FONT-SIZE: 18pt""&gt;Close the Monthly LAD and Lanyard Work orders to show they were executed. &lt;/span&gt;&lt;/div&gt;']:
    print(bs4.BeautifulSoup(cell).text.strip())
</code></pre>

<p>Result:</p>

<pre><code>The indicator lights on the control cabinetÂ are to be replaced with 24VdcÂ LED's. 3 Red &amp;Â 3 Green.
Close the Monthly LAD and Lanyard Work orders to show they were executed.
</code></pre>

java python html web-scraping