Search code examples
javascriptgwtgoogle-apps-scriptgoogle-apps

Can scripts write/read directly to/from Google Document?


I want to create a script that would do the followings:

  • create a form
  • once a user fill the form and submit, the script would copy a
    previously created Google Document "template" and fill out the fields the copied template with the information submitted.

Now I am aware that you can not create scripts within the "Document" container (only Spreadsheet and Sites), but can a standalone Google Apps Script read or write directly to Document like the way it could with Spreadsheet?

I read somewhere that Google Apps Script can not read text from a Google Document, but only text and CSV. Is that still true with the recently update to Google Apps Script?


Solution

  • Yes, this can be done. The easiest example to follow is Employee of the Week example. This takes in user input , merges it into a doc and automatically emails the result out to the user, which you can remove if you like. There also a video tutorial. Should get you pointed in the right direction.