The following Google Apps Script is designed to remove all HTML tags within the content of a cell by using a regular expression (regex). It was developed as a more advanced version of
this HTML email body blog post in that it could dynamically remove various instances of HTML tags used (eg
<font></font>, <br />, <strong></strong>) all in one go.
|
Screenshot of cell containing HTML tags and text |
The regex uses '
replace' to identify the HTML tags and remove then (or technically replace them with nothing):
var cleanContent = cell.replace(/<[^>]+>/mg,"");
Regex - remove HTML tags.xlsx
No comments:
Post a Comment