Remove HTML In Google Sheets Cells

2020-02-24 12:02发布

Trying to determine the best method to automatically remove HTML in all cells within a column in Google Sheets.

Example of cell data:

<span style="color:#0000FF">test</span>

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.

2条回答
爱情/是我丢掉的垃圾
2楼-- · 2020-02-24 12:20

You could use REGEXREPLACE function:

=REGEXREPLACE(A1,"</?\S+[^<>]*>","")

This formula also can be converted into ArrayFormula:

=ARRAYFORMULA(REGEXREPLACE(offset(A1,,,COUNTA(A:A)),"</?\S+[^<>]*>",""))

This formula would populate down automatically. COUNTA(A:A) is number of rows in column [A] with your data

查看更多
【Aperson】
3楼-- · 2020-02-24 12:24

You can just use a Find and Replace dialog.

Find what: </?\S+[^<>]*>

Replace with: <empty string>

Search: Specific range = '<SHEET_NAME>'!<COLUMN>:<COLUMN> (e.g. 'Copy of Sheet1'!A:A)

Make sure Search using regular expressions is checked. Then, click Replace all.

Here is a screen:

enter image description here

查看更多
登录 后发表回答