删除Google表格单元格中的HTML [英] Remove HTML In Google Sheets Cells
问题描述
尝试确定自动删除Google表格中列中所有单元格中HTML的最佳方法.
Trying to determine the best method to automatically remove HTML in all cells within a column in Google Sheets.
单元格数据示例:
<span style="color:#0000FF">test</span>
我想删除所有HTML并在添加新行时自动保留纯文本.
I'd like to strip out all of the HTML and leave the plain text, automatically whenever a new row is added.
我不确定在单元格中使用正则表达式作为公式还是某种类型的脚本是否会是更好的方法.
I'm not sure if using a regex in the cell as a formula or some type of script would be a better approach.
推荐答案
您可以使用REGEXREPLACE函数:
You could use REGEXREPLACE function:
=REGEXREPLACE(A1,"</?\S+[^<>]*>","")
此公式也可以转换为ArrayFormula:
This formula also can be converted into ArrayFormula:
=ARRAYFORMULA(REGEXREPLACE(offset(A1,,,COUNTA(A:A)),"</?\S+[^<>]*>",""))
该公式将自动填充. COUNTA(A:A)是[A]列中包含您的数据的行数
This formula would populate down automatically. COUNTA(A:A) is number of rows in column [A] with your data
这篇关于删除Google表格单元格中的HTML的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!