Internal Tool

Meta Copy Doc Generator

Generate localized Google Docs from one template using spreadsheet data. A separate, fully populated document for every locale, produced automatically.

This tool is approved by IT and hosted on TGD's secure server. You will be asked to sign in with your Google account. You can approve this confidently.
Overview of how it works +

Step 01

Sign in with Google

Before using the tool you authenticate with Google. You'll be redirected to sign in, then asked to approve access to Docs (read & copy documents), Sheets (read your data), and Drive (browse folders and save output).

You must use your TGD Google account to sign in.

Step 02

Setting up the template

Your template is a Google Doc containing placeholders that get replaced with locale-specific content. The tool copies this template for each locale and performs the replacements.

Placeholder syntax

The script reads strings inside double curly braces as variables to swap out anywhere in the document, including tables and the page title.

Module 3: Feature carousel
Carousel Image 1: Batman
[Eyebrow] {{MQ3/BTF/3/A/Eyebrow}}
[Head] {{MQ3/BTF/3/A/Headline}}
[Sub] {{MQ3/BTF/3/A/Body}}
[Feature] {{MQ3/BTF/3/A/Feature}}
[Legal] {{MQ3/BTF/3/A/Legal}}

Carousel Image 2: Social gaming
[Eyebrow] {{MQ3/BTF/3/B/Eyebrow}}
[Head] {{MQ3/BTF/3/B/Headline}}
[Sub] {{MQ3/BTF/3/B/Body}}
[Legal] {{MQ3/BTF/3/B/Legal}}
  • Placeholders are case-insensitive.
  • Variables cannot include spaces.
  • The special {{doc-title}} placeholder populates both the document title and the filename, appended with the locale code(s) you select.
Check the ticket description for any exceptions, changes, or special considerations.

Prepare your template

  • Open the copy doc example document and make a copy.
  • Mark it as a template by adding [TEMPLATE] at the beginning of the doc title.
  • Drop the new template doc in your template folder.
  • The example copy doc defaults to en-US. The en-US column in the spreadsheet is what you will use for comparison.

Get your variables ready

  1. Open the content spreadsheets you need.
  2. Open a local instance of Excel.
  3. Here is the visible column layout of the spreadsheets:
    Column CColumn D [Hidden]Column E
    VariablesStringen-US

    The other visible columns represent the other locales.

  4. Select columns C and E and paste them into your local Excel. There is a hidden column in the middle with the heading Type; just delete that column.
  5. Open an instance of Copilot in Excel. Use this prompt (replace the column letter with whichever column has the variables from Column C in the spreadsheet):
    In column A, remove any spaces before or after the strings in the cells, and surround them with double curly brackets.

Now you have copy/paste placeholder variables ready to go.

Tag the template

  • For reference, open the appropriate Figma delivery file for en-US.
    This helps when the order of variables in the spreadsheets does not match the order of strings in the example copy doc.
  • Place your template doc and the local Excel spreadsheet with the tagged variables side by side.
  • Start replacing strings in the template with the variables (including the double curly brackets).
A note about matching variables with the correct string: Most of the time, most strings will match 1:1. Sometimes something will be moved, or a component will be added or removed. If you see something that doesn't make sense, refer to the Figma delivery file. If you still can't make it make sense, consult the PM.

Conditional sections

Some content should appear only for specific locales: retailer blocks, region-only features, specific components. You mark that content with a named range so the tool only includes it in the appropriate copy docs.

Conditional sections are applied to individual copy doc templates as needed.

One-time setup You add this Apps Script to a template once. It gives Docs a menu for marking sections.
Section-marker Apps Script Show instructions

Creating the conditional sections in the doc

  1. Consult the Asana task for what components should and should not display in generated docs. For instance, es-MX does not get gift card modules.
  2. Select the section that will be conditional. Be sure to select the line break after it, so that when that section is removed, you don't end up with an extra line break when it's gone.
    Example data spreadsheet
  3. When you choose "Mark selection as section", the script you added to the template will begin running. You will have to authorize again.
  4. You will be prompted to name the section. Do not include spaces, keep them simple but readable. Use dashes or underscores.
  5. Click OK

When the tool runs, it will search your template for conditional sections, and you will be able to select what locales those sections will appear in. You can have multiple conditional sections in a single copy doc template.

Tip: When marking a section, select complete elements (whole paragraphs, tables, or images) so removal stays clean. Names should be lowercase-with-hyphens (e.g. best-buy).
Step 03

The content spreadsheets

Your spreadsheet maps each variable name to its value in every locale. Variable names live in column C; each locale gets its own column to the right starting with en-US in column E. On the spreadsheet, the locale codes will appear in the header of each column.

Notes on the spreadsheets

  • Be sure you are using the most current version. Consult the Asana task description.
  • The spreadsheets must be Google Sheets. If they are Excel sheets, they must be converted to Sheets before they can be used.
  • You have two options for adding the spreadsheets: you can copy the URL for each spreadsheet into the tool, or if you have all your spreadsheets in one folder, you can provide the URL for that folder in the tool, and then the tool will allow you to select the spreadsheets you want to use.
Variable names in column C must match your placeholder names (case-insensitive). Avoid spaces; use hyphens or underscores. If there are duplicate variables the last loaded value wins.
Step 04

Using the tool

Step by step instructions.

The overview: Load, select, generate

1
Load & select tabs
Click Load Tabs, then check the tabs that hold variable data.
2
Load & select locales
Click Load Locales, then check the locales to generate. Use Select / Deselect All.
3
Configure conditional sections
For each section, check the locales that should include it. Unchecked locales have it removed.
4
Generate documents
Click Generate Documents. One copy per locale, placeholders filled, sections handled, saved to your folder.

  1. Open the tool
    Initial screen
    Initial screen
  2. Copy the template URL into the Template Document field
  3. Under Spreadsheets you have two options to add the spreadsheets you need for the copy docs:
    • Enter URLs manually: Add the URLs in the URL or spreadsheet ID, adding new fields as needed with the + Add Spreadsheet button
    • Select from folder: If all your spreadsheets are in the same folder, you can add the URL for the folder and when you click Load all spreadsheets present in that folder will be listed with checkboxes to select the ones you need.
  4. Once you have selected your spreadsheet URLs, click Load tabs.
    Select tabs screen
    Select tabs screen
  5. The tabs for each spreadsheet will be loaded with checkboxes. Check the tabs that are relevant to the copy doc you are generating. Click Load Locales
    Select locales screen
    Select locales screen
  6. The tool will identify all the language columns included in the spreadsheets. It will not identify if the columns are populated.
    Select all the locales you want to generate copy docs for.
  7. Conditional Sections: If there are conditional sections marked in the template, they will display here. Check any locale where the named section SHOULD DISPLAY. Any locales not marked will NOT display that section.
    Add filename and output folder screen
    Add base filename/doc title and output folder location
  8. Base Filename: The filename and the document title are the same, so this field informs both those things. Find the expected base filename in the spec sheet listed in the task description. Put it in this field, without the underscore or lang-CNTRY.
  9. Output Folder: Add the URL of the folder location where you want this to populate.
  10. To generate, click Generate Documents. It can take a minute for them to populate in the output folder. Sometimes reloading the folder page helps.
  11. Once the docs are generated, you will have the option to Generate More and Clear Form.
    Results screen
    Results screen
Step 05

Understanding results

A progress bar fills as each locale is processed (you can Cancel; already-generated docs are kept). When it finishes, results split into two lists.

Files are named {base-filename}_{locale}, e.g. Product Sheet_en-US, Product Sheet_fr-CA. Use Generate More to keep your settings, or Clear Form to start fresh.

Troubleshooting

"Not authenticated" error+
"Permission denied" on a document or folder+
A placeholder is not being replaced+
Duplicate or conflicting values+
A conditional section is not removed+
"Section Markers" menu missing in the template+
Template must be a native Google Doc+
Where to find detailed error logs+