[ appscript ] Document

FindText in Document

// Get the body section of the active document.
var body = DocumentApp.getActiveDocument().getBody();

// Search until the paragraph is found.
var foundElement = body.findText("Pong:.*?Yesterday")
if(searchResult) {
var par = foundElement.getElement().getText();
var startPosition = foundElement.getStartOffset();
var endPosition = foundElement.getEndOffsetInclusive();

ref : https://developers.google.com/apps-script/reference/document/body


Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s