thwippp
1/12/2017 - 4:52 PM

Replace Place Holders-- Google Docs

Replace Place Holders-- Google Docs

function searchAndReplace() {
  var body = DocumentApp.openById("1QBh6wd-OxLZ7nXL5UY2oQHLWzIfG4VKZ7_5T6T65OW4").getBody();
  var client = {
    name: 'Joe Script-Guru',
    address: '100 Script Rd',
    city: 'Scriptville',
    state: 'GA',
    zip: 94043
  };

  body.replaceText('{date}', Date());  //Inserts current date
  body.replaceText('{address}', client.address);
  body.replaceText('{city}', client.city);
  body.replaceText('{state}', client.state);
  body.replaceText('{zip}', client.zip);
}