How do you remove all formatting tags when calling:
GmailApp.getInboxThreads()[0].getMessages()[0].getBody()
such that the only remainder of text is that which can be read.
Formatting can be destroyed; the text in the body is only needed to be parsed, but tags such as:
"&"
<br>
and possibly others, need to be removed.
I am not sure what you mean by
.getBody()– is this supposed to return a DOM body element?However, the simplest solution for removing HTML tags is probably to let the browser render the HTML and ask him for the text content:
With the above example, the
textContentvariable will contain the text(Note the line break due to the
<br />tag.)