Search code examples
google-apps-scriptgoogle-docsgoogle-docs-apigoogle-drive-api

edit google document remotely


I'm trying to add a feature to my website as follows:

Clicking a button appends text to a Google document.

Obviously I will need to create an Apps Script in the drive. The question is how to trigger the Apps Script from my website. You can assume that I am the owner of the drive/document and so have permissions to edit it in any way I like.

I have looked at these topics:

  1. Workarounds : How to edit native google documents programatcally?item
  2. How to programmatically manipulate native google doc files

It seems they are all actions performed from the drive itself and not triggered remotely.

I have also looked up the Apps Script API in Google but have not found a way to do this. Is it even possible?


Solution

  • Yes, it is possible.

    First write an Apps script that changes your desired document. Then deploy it as a web-app running as you that anyone has access, even anonymous. Check out the guides at Apps Script page to see how to write your script as a web-app.

    Your script will then have a public url, which you can call from your website and have it run "remotely" normally.