Replace Text

Last Updated: May 10, 2022


Use this function to replaces an old text with new text in the Google Doc.


Replace Text (document_id, old_text, new_text, private_key, client_email)


Input Parameter Name Description
document_id Name of the document
old_text Text to be replaced
new_text New text to be updated
private_key Private key of the service account
client_email Email ID of the service account


Return Value Description
  • On Success returns 1, Text replaced successfully
  • On Failure returns 0, Error Message


Replace Text (XYZ123, Travel, Commute, —–BEGIN PRIVATE KEY—–\nABCD\n—–END PRIVATE KEY—–,

  • Uses the private key —–BEGIN PRIVATE KEY—–\nABCD\n—–END PRIVATE KEY—– to connect to the Email ID, replaces the text Travel with the text Cmmute in the Google Doc with ID XYZ123.
    Returns Text replaced successfully after replacing the text.

To view all the Google Docs functions, click here.

Did you find what you were looking for?