1

I would like to have a Chrome Extension interact with the contents of a Google Doc - specifically to add text and ideally html to a document with the click of a button in the Extension popup.

I've read that a Google Extension can 'talk' to a Google Docs Script - to gain access to the script model and its commands.

Can you hand off a string from a Chrome Extension and have a Google Docs Script take that string and then insert it into the document (at the cursor location, for instance)?

Would the user have to manually approve the script each time it was called? Or just installed once and then the process runs in the background?

A commenter gave a very helpful link to a similar need and solution for Google Sheets. But that solution (see comments below) depends on Google Sheets APis and there does not seem to be an equivalent Google Docs API.

11teenth
  • 1,853
  • 1
  • 15
  • 28
  • Hi. I think [this post](http://stackoverflow.com/a/23453239/4625829) is relatively similar. It discusses writing to a Google Spreadsheet from a Chrome extension. The behavior you were aiming for is to write to a Doc (kinda like Word Document). It's possible that you can use the above link as reference and find the corresponding (counterpart) codes needed for a Doc instead of a Spreadsheet. Care to look into it and let me know if it what you were looking for? – AL. Apr 27 '17 at 07:53
  • Thank you for reading...and yes, that post was helpful...but there doesn't seem to be a corresponding Google Docs API. There is a Drive API, but I doubt you can get inside an existing/open Google Doc to append data to it... – 11teenth Apr 28 '17 at 11:32

0 Answers0