Hi
makesure you set up you Setup worksheet accordingly, see below
That error means that the template (master doc) you are using is a document that you don't have access to or it's simply not anymore which could happen if youd don't have an id or the correct id in you setup tab.
also, in your setup worksheet make sure you enter the correct document id, which the string of characters in the document url
https://docs.google.com/document/d/this the document id/edit?tab=t.0

you don't need the CODIGO and AÑO fields, I do because I use those in my doc merger becuase I want the pdf that is created to include those values in the name of the pdf and I also use CODIGO as one of the values that I merged into the resulting pdf.
you could possible modify this portion of the script, or simply copy my script to google ai studio and just tell google what you'd like to change and the result simply copy it back to you google apps script
