How to Auto-Populate Google Docs from Google Sheets
How to Auto-Populate Google Docs from Google Sheets
The Copy-Paste Trap: Why Spreadsheet-to-Document Manual Work Kills Productivity
You have all the data in Google Sheets. You need a document—a proposal, invoice, report, contract, certificate. So you open the template, scroll to the right cell in the spreadsheet, copy the value, click back to the document, paste it. Repeat 20 times. Proofread. Format anything that broke. Save. Repeat for the next row.
If this sounds familiar, you're paying what we call the copy-paste tax: invisible hours drained from your week, every week, for work a computer could do in seconds.
This guide covers exactly how to auto-populate Google Docs from Google Sheets—the mechanics, the tools, and step-by-step setup you can implement today.
Why Google Sheets Is the Perfect Data Source for Document Automation
Google Sheets works as a document data source for several reasons:
- Everyone already uses it. Client lists, project data, inventory, employee records—it's probably already in a spreadsheet.
- It's structured. Each column is a field, each row is a record. That maps perfectly to template variables.
- It's shareable. Multiple people can update the source data, and everyone gets documents from the same source of truth.
- It supports formulas. Calculated fields (totals, dates, conditional values) work perfectly as document inputs.
- Google's ecosystem. Sheets and Docs talk to each other natively via Apps Script and Google Workspace APIs.
The basic concept: your Google Sheet has rows of data, your Google Docs template has placeholder variables, and automation connects them—replacing variables with real values and producing complete documents.
Three Approaches to Auto-Populate Google Docs from Sheets
Approach 1: Doc Variables (Best for Most Users)
Doc Variables is a Google Docs add-on built specifically for template variable replacement. It handles the document side of automation—you define variables in your template, and Doc Variables replaces them with data from your spreadsheet.
Best for: Teams that need a repeatable, no-code solution for generating multiple documents from a spreadsheet at once.
Approach 2: Google Apps Script (Best for Custom Logic)
Apps Script is Google's built-in JavaScript environment. It runs inside Google Workspace and can read your Sheet, modify your Doc, move files in Drive, and send emails—all automatically.
Best for: Developers or technical users who need custom logic (conditional sections, multiple templates, complex formatting).
Approach 3: Zapier / Make (Best for No-Code + External Data)
Visual automation platforms that connect Google Sheets and Google Docs without any code. Good when you're also connecting to external tools (CRMs, payment processors, form builders).
Best for: Non-technical users who need to connect Sheets to Docs as part of a larger multi-app workflow.
We'll cover all three in detail below.
Method 1: Auto-Populate with Doc Variables
Step 1: Install Doc Variables
In Google Docs, go to Extensions → Add-ons → Get add-ons → Search "Doc Variables" → Install. Authorize the permissions when prompted.
Step 2: Build Your Google Docs Template
Create a Google Docs document that serves as your template. For every piece of data you want to pull from Sheets, insert a variable using double curly braces:
CLIENT PROPOSAL
Prepared for: {{Client Name}}
Company: {{Company}}
Date: {{Date}}
Dear {{Client Name}},
Thank you for considering our services for your {{Project Type}} project. Based on our conversations, we propose the following:
Project: {{Project Description}}
Timeline: {{Timeline}}
Investment: {{Total Price}}
Terms are net {{Payment Terms}} days.
Sincerely,
{{Account Manager}}
Variable names must match the column headers in your Google Sheet exactly (case-sensitive).
Step 3: Set Up Your Google Sheet
Your spreadsheet column headers become your variable names. For the template above, you'd have columns:
- Client Name
- Company
- Date
- Project Type
- Project Description
- Timeline
- Total Price
- Payment Terms
- Account Manager
Each row is one document. 50 rows = 50 documents.
Step 4: Generate Documents
Open your template in Google Docs → Extensions → Doc Variables → Generate from Spreadsheet. Select your Google Sheet, choose which rows to generate, pick an output folder, and click Generate.
Doc Variables creates one document per row, replaces all variables with the row's data, and saves them to your Drive folder—named automatically from the data.
Method 2: Auto-Populate with Google Apps Script
Apps Script gives you full programmatic control. Here's a complete working script you can adapt:
Step 1: Open Apps Script from Your Sheet
In Google Sheets: Extensions → Apps Script. This opens the script editor attached to your spreadsheet.
Step 2: The Core Script
function generateDocumentsFromSheet() {
// Configuration — update these IDs
var TEMPLATE_DOC_ID = 'YOUR_TEMPLATE_DOC_ID';
var OUTPUT_FOLDER_ID = 'YOUR_OUTPUT_FOLDER_ID';
var SHEET_NAME = 'Sheet1'; // or whatever your sheet tab is named
var ss = SpreadsheetApp.getActiveSpreadsheet();
var sheet = ss.getSheetByName(SHEET_NAME);
var data = sheet.getDataRange().getValues();
var headers = data[0]; // First row = column headers = variable names
var template = DriveApp.getFileById(TEMPLATE_DOC_ID);
var outputFolder = DriveApp.getFolderById(OUTPUT_FOLDER_ID);
// Loop through each data row (skip header row)
for (var i = 1; i < data.length; i++) {
var row = data[i];
// Skip empty rows
if (!row[0]) continue;
// Build a key-value map of this row's data
var variables = {};
headers.forEach(function(header, index) {
variables[header] = row[index] !== undefined ? row[index] : '';
});
// Copy the template
var docName = variables['Client Name'] + ' — ' + variables['Project Type'] + ' Proposal';
var newDoc = template.makeCopy(docName, outputFolder);
// Open and populate the document
var doc = DocumentApp.openById(newDoc.getId());
var body = doc.getBody();
// Replace each variable placeholder
Object.keys(variables).forEach(function(key) {
var value = variables[key];
// Handle dates formatting if needed
if (value instanceof Date) {
value = Utilities.formatDate(value, Session.getScriptTimeZone(), 'MMMM d, yyyy');
}
body.replaceText('\{\{' + key + '\}\}', String(value));
});
doc.saveAndClose();
Logger.log('Created: ' + docName);
}
Logger.log('Done! Generated ' + (data.length - 1) + ' documents.');
}
Step 3: Get Your IDs
Find your Template Doc ID from its URL: docs.google.com/document/d/THIS_IS_YOUR_ID/edit
Find your Output Folder ID from Drive URL: drive.google.com/drive/folders/THIS_IS_YOUR_ID
Paste both into the configuration section of the script.
Step 4: Run It
Click the play button (▶) next to generateDocumentsFromSheet. Authorize when prompted. Check your output folder—documents should appear within seconds.
Advanced: Trigger on New Row
Instead of running manually, trigger automatically when data is added to the sheet:
function onEdit(e) {
var sheet = e.source.getActiveSheet();
var range = e.range;
// Only trigger on Column A (first column) additions
if (range.getColumn() === 1 && range.getRow() > 1) {
var row = sheet.getRange(range.getRow(), 1, 1, sheet.getLastColumn()).getValues()[0];
if (row[0]) {
generateDocumentForRow(row, getHeaders(sheet));
}
}
}
Now every time someone adds a new row to your Sheet, a document generates automatically in the background.
Method 3: Auto-Populate with Zapier or Make
Zapier Setup
Zapier connects Google Sheets and Google Docs without any code:
Trigger: Google Sheets — New or Updated Row
Action: Google Docs — Create Document from Template
In the action setup, Zapier shows you all variables in your template and lets you map them to Sheets columns using a dropdown. No scripting required.
Pricing note: Zapier's free tier handles 100 tasks/month. For higher volumes, paid plans start at $19.99/month.
Make (formerly Integromat) Setup
Make offers more power at lower cost, especially for complex workflows:
- Create a new scenario
- Add Google Sheets module: Watch Rows
- Add Google Docs module: Create a Document from a Template
- Map the column values to template variables
- Add Google Drive module: Move a File (to your output folder)
Make handles conditional routing—use a different template based on a column value, for example.
Real-World Use Cases
Use Case 1: Client Proposals from CRM Export
The workflow: Export leads from your CRM to Google Sheets → Run automation → Generate one proposal doc per row → Move to client-specific Drive folder
Time saved: 20 minutes per proposal → 2 minutes per proposal
Template variables used: {{Contact Name}}, {{Company}}, {{Industry}}, {{Service Package}}, {{Monthly Investment}}, {{Contract Term}}, {{Account Manager}}
Use Case 2: Employee Offer Letters
The workflow: HR enters new hire data in a Google Sheet → Automation generates personalized offer letters → HR reviews and sends
Template variables: {{First Name}}, {{Position Title}}, {{Department}}, {{Start Date}}, {{Annual Salary}}, {{Benefits Start Date}}, {{Manager Name}}, {{Office Location}}
Time saved: HR goes from 45 minutes per offer letter to reviewing a finished draft in 5 minutes
Use Case 3: Monthly Client Reports
The workflow: Analytics data exported to Sheets → Script loops through each client row → Generates branded PDF-ready report for each client
Template variables: {{Client Name}}, {{Month}}, {{Sessions}}, {{Conversions}}, {{Revenue}}, {{Top Channel}}, {{MoM Growth}}, {{Next Month Goals}}
Bonus: Add a column for "email address" and script auto-emails each client their report as a PDF attachment
Use Case 4: Event Certificates and Badges
The workflow: Attendees in Sheets → One click generates certificates for all attendees → Emailed automatically
Template variables: {{Attendee Name}}, {{Event Name}}, {{Date}}, {{Course Title}}, {{Completion Hours}}
Volume: 500-attendee event = 500 certificates generated in under 2 minutes
Advanced Techniques
Conditional Content Based on Cell Values
Use Doc Variables' conditional syntax to show different document sections based on spreadsheet values:
{{#if Service Package == "Premium"}}
As a Premium client, you receive dedicated account management, 24/7 priority support,
and quarterly business reviews included in your investment.
{{/if}}
{{#if Contract Term >= 12}}
We're pleased to offer a 10% loyalty discount for your 12-month commitment.
{{/if}}
The spreadsheet data drives not just the variables, but entire sections of content.
Calculated Fields in Sheets
Let Google Sheets do the math before it reaches the document:
- Column G: Monthly Price (manual entry)
- Column H: =G2*12 (Annual Price, calculated)
- Column I: =G2*12*0.9 (Annual Price with 10% discount)
- Column J: =TEXT(TODAY(),"MMMM d, yyyy") (Today's date, formatted)
Reference {{Annual Price}} and {{Annual Price Discounted}} in your template—the math is already done, formatted exactly right.
Dynamic Document Naming
Name generated documents so they're findable instantly:
// In Apps Script
var docName = variables['Company'] + ' — ' + variables['Service Type'] +
' — ' + Utilities.formatDate(new Date(), 'America/Chicago', 'yyyy-MM-dd');
// Result: "Acme Corp — Strategy Proposal — 2026-04-08"
No more "Copy of Proposal Template (7)."
Batch Selection: Generate Specific Rows
Add a "Generate?" checkbox column to your Sheet. Modify the script to only process rows where the checkbox is checked:
// Only generate if column B (index 1) is checked
if (!row[1]) continue; // Skip unchecked rows
Select specific rows in the Sheet, check their boxes, run the script. Only those documents generate—useful when you have a mix of ready and not-ready records.
Auto-Organize Output by Category
function getOrCreateSubfolder(parentId, folderName) {
var parent = DriveApp.getFolderById(parentId);
var existing = parent.getFoldersByName(folderName);
return existing.hasNext() ? existing.next() : parent.createFolder(folderName);
}
// Usage: organize proposals by client industry
var industry = variables['Industry'];
var clientFolder = getOrCreateSubfolder(OUTPUT_FOLDER_ID, industry);
var newDoc = template.makeCopy(docName, clientFolder);
Documents auto-sort into subfolders. Zero manual filing.
Formatting Pitfalls and How to Fix Them
Pitfall 1: Date Format Mismatch
Google Sheets stores dates as serial numbers internally. When your script reads a date cell, you might get "46,559" instead of "April 8, 2026."
Fix in Apps Script:
if (value instanceof Date) {
value = Utilities.formatDate(value, 'America/Chicago', 'MMMM d, yyyy');
}
Fix in Sheets: Add a helper column with =TEXT(A2,"MMMM d, yyyy") and reference that column in your template instead.
Pitfall 2: Currency Formatting Lost
A Sheets cell formatted as "$12,500.00" may arrive in your doc as "12500."
Fix: Use a TEXT formula in Sheets: =TEXT(G2,"$#,##0.00") in a helper column, and reference that column in your template.
Pitfall 3: Variable Name Case Sensitivity
{{client name}} ≠ {{Client Name}} ≠ {{CLIENT NAME}}. If the column header and template variable don't match exactly, replacement fails silently.
Fix: Copy column headers directly from Sheets and paste them into your template variables. Don't retype.
Pitfall 4: Special Characters Breaking replaceText()
In Apps Script, replaceText() uses regular expressions. Characters like (, ), ., + in column names break the search pattern.
Fix: Escape special characters in column names:
var escapedKey = key.replace(/[.*+?^${}()|[\]\]/g, '\$&');
body.replaceText('\{\{' + escapedKey + '\}\}', String(value));
Pitfall 5: Blank Cells Creating Awkward Gaps
Optional fields that are blank create {{Variable}} or empty sentences in the output.
Fix: Use conditional sections in Doc Variables:
{{#if Notes}}
Additional Notes: {{Notes}}
{{/if}}
Google Workspace Permissions and Sharing
Who Can Generate Documents?
When using Apps Script or Doc Variables, the person running the automation needs:
- Editor access to the Google Sheet (to read data)
- Editor access to the template document (to read/copy it)
- Editor access to the output folder (to create new files)
Shared Templates in Google Drive
Store your template in a shared Drive folder where the team has access. When the automation copies the template, it creates the new document in the output folder—the template itself stays untouched.
Locking the Template
To prevent team members from accidentally editing the master template, put it in a shared folder but give most people "Viewer" access. Only admins need "Editor" access to update the template.
Scaling Up: High-Volume Document Generation
Apps Script Quotas
Apps Script has execution time limits: 6 minutes per execution for Workspace accounts, 6 hours of total daily execution. For most teams, this is more than enough. If you're generating thousands of documents, split into batches:
// Process in batches of 50
var BATCH_SIZE = 50;
var startRow = PropertiesService.getScriptProperties().getProperty('startRow') || 1;
startRow = parseInt(startRow);
for (var i = startRow; i < Math.min(startRow + BATCH_SIZE, data.length); i++) {
// ... generate document for this row
}
// Save progress for next run
PropertiesService.getScriptProperties().setProperty('startRow', startRow + BATCH_SIZE);
Drive Storage
Google Docs files don't count against your Drive storage quota (only uploads do). You can generate thousands of Docs without worrying about storage costs.
Getting Started: Your First Auto-Populated Document in 20 Minutes
Here's the fastest path to your first working automation:
Minutes 1–5:
Create a Google Sheet with 5 sample rows and 5-7 columns. Use realistic column headers (First Name, Company, Project, Date, Amount).
Minutes 5–10:
Create a Google Docs template. Insert variables matching your column headers exactly: {{First Name}}, {{Company}}, {{Project}}, {{Date}}, {{Amount}}.
Minutes 10–15:
Install Doc Variables → Extensions → Doc Variables → Generate from Spreadsheet → Select your Sheet → Select rows → Generate.
Minutes 15–20:
Open the generated documents. Verify the variables were replaced correctly. Adjust column names or template variables if anything didn't match.
By minute 20, you have a working automation. Everything after is refinement.
The Bottom Line: Your Spreadsheet Data Is Already Ready
The data you need is already in Google Sheets. The documents you need to create are already templated in Google Docs. The only missing piece is the automation connecting them—and as this guide shows, that connection is straightforward to build.
Stop paying the copy-paste tax. Every row in your spreadsheet that needs a corresponding document is an automation opportunity. Build it once, and your data generates professional documents on demand—whether it's 5 proposals or 500 certificates.
Doc Variables makes auto-populating Google Docs from Google Sheets simple—no coding required for the basics. Define variables in your template, connect your spreadsheet, and generate documents in bulk in seconds. Try it free at docvars.com.
Ready to try Doc Variables?
Join 190,000+ users creating amazing Google Doc templates.
Install Now - It's Free