3

The title says it all. I want to use the GDrive API (or maybe the Google Doc, sheets or slide APIs) to create a document based on a template from the Template Gallery.

I already know how to create a Google Doc with GDrive API. But it's a blank one. I want to create a doc using one of my company templates (the same way you do when clicking on New -> Google Docs/Sheets/Slides -> From a Template menu in the GDrive web. See image) enter image description here

The solution involving creating a blank document from a template, and using it as a source to copy it as a new doc doesn't work for me because it would be static. The templates are often modified and I don't want to have to periodically check if they have changed or not to update my reference docs.

Patrick M.
  • 750
  • 3
  • 10
  • 21

1 Answers1

1

Templates with Drive API.

Unfortunately it seems that the Drive, Sheets and Docs API, do not support or have any methods that would allow access to either the default templates or the templates from the organization.

The only workaround would be to build a template as a normal Drive file and gather the ID of the particular file so you can run a:

files.copy

Which by the way is also suggested over the official documentation on how to merge text into a document and probably the only mention of templates over the Docs API:

It creates normal documents as you suggest in your post and basically edit them to later just make a copy.

One more thing that could be an excellent idea would be to make a suggestion or send feedback to request a feature to allow the management and creation of templates from the Drive API, you can do so here:

References:

  • 1
    Thanks a lot Ricardo. The workaround you're suggesting is the one I mentioned in my question. Until no other possibilities are available, I guess it'll have to do. But it's far less than ideal. I will give a shot to the feature request to Google.. without much hope.. – Patrick M. Feb 24 '23 at 14:28
  • Here is the Feature Request: https://issuetracker.google.com/issues/270545503 – Patrick M. Feb 24 '23 at 14:48
  • 1
    Awesome, sounds good, I would be giving my like and share so it starts to get attention and support, as it seems like something that has been discussed before but not requested. – Ricardo Jose Velasquez Cruz Feb 24 '23 at 14:52
  • 1
    @PatrickM. this was a good question, I was having issues with the same. I just +1 the feature idea you shared, hopefully this is implemented in the future. You may want to upvote this answer as although it was not the most desired answer it is the only option given this context. – Yancy Godoy Feb 27 '23 at 17:39