Some work with Google Apps Scripts
This takes a Google Spreadsheet of information, and will fill a Google Doc Template that you made.
- Create a New Google Doc
- I reccomend giving your template a view only access so people don't mess it up
- All fields that you want to import, need to be enclosed in double pound signs
- Example: "##TITLE##"
- Note: these tags need to be in the BODY of the doc, not header or footer
- Example:
- Create a New Google Sheet
- Add Required Columns:
- Create Document (Check Box)
- Document Created (Empty - for now)
- Document Link (Empty - for now)
- Doc Name (this will be the name of the doc you will be creating)
- Ensure that the column headers (row 1) match your template fields
- Example:
- Copy this script into your own script editor
- Copy over the custom fields
- ID of your template into line 21 of the script
- Set up a trigger on edit (important for the automation) 8a) Navigate Here
8b) Configure Your Trigger
Note: You can set how often you want to get an update on this script, daily is default
- New Document will be created in the same folder as your template.
- The current date willl be appended to the back of your Doc Name.
You now can dynamicly add columns and template tags. As long as they match, they will be imported to your document.
If you aren't seeing the template be filled properly, check that the column name and the tag are exactly the same.
Formating is controlled by the Google Doc, not the sheet, so make sure your format is correct in the template.
You now will see your created document with the forms filled in:
How the sheet looks upon completion:
The script will trigger when you check the box in the "Create Document" column. It checks for a few things prior to running:
- Did you just check this cell ("Create Document")
- Is the cell named "Document Created" empty
- if not, it will not run again
- this is a great way to create a new template, delete the data in the "Dcoument Created" column, and check the box again
- The script creates a copy of your template
- all properties (including notifications) will be copied over from your template
- Then all tagged fields are replaced with the sheet data