Doc Variables
← Back to Resources

Connect Salesforce to Google Docs Templates: Automate Contracts, Proposals & More

Connect Salesforce to Google Docs Templates: Automate Contracts, Proposals & More

Your sales team lives in Salesforce. Contact details, deal amounts, close dates, product selections—everything about a deal is meticulously tracked in your CRM. But when it's time to send a contract, someone opens Google Docs, finds an old agreement, and starts the tedious copy-paste dance.

What if clicking "Closed Won" in Salesforce automatically generated a complete, ready-to-sign contract with all the deal details already filled in?

That's exactly what the Salesforce + Doc Variables integration enables. Connect your CRM data directly to your Google Docs templates and eliminate document creation from your sales process entirely.

Why Connect Salesforce to Google Docs?

Sales teams using Salesforce already have all the data they need for contracts, proposals, and other documents:

  • Account name and billing address
  • Contact name, title, and email
  • Opportunity amount and close date
  • Products or services selected
  • Payment terms and special conditions
  • Sales rep name and territory

Manually transferring this data to documents is not only slow—it's error-prone. A single typo in a client name or a wrong dollar amount can delay deals, damage relationships, or create legal issues.

Automating this connection eliminates manual data entry entirely. The contract that used to take 20 minutes now takes zero minutes—it generates itself.

What Documents Can You Automate?

Any document that pulls from Salesforce data is a candidate for automation:

Sales Documents:

  • Contracts and service agreements
  • Proposals and quotes
  • Statements of work (SOWs)
  • Order forms and purchase orders
  • Non-disclosure agreements (NDAs)

Customer Communications:

  • Welcome packets for new clients
  • Renewal reminders and offers
  • Upsell and cross-sell proposals
  • Account review summaries

Internal Documents:

  • Deal summaries for leadership
  • Commission reports
  • Territory handoff documents
  • Win/loss analysis reports

How the Integration Works

The Salesforce + Doc Variables integration uses Zapier as a bridge between your CRM and Google Docs. Here's the flow:

  1. Trigger: Something happens in Salesforce (deal closes, stage changes, record created)
  2. Data Pull: Zapier retrieves the relevant Salesforce record fields
  3. Document Generation: Doc Variables creates a new document from your template, replacing all variables with Salesforce data
  4. Output: The finished document saves to Google Drive, ready for review or signature

The entire process happens automatically, in seconds, with no manual intervention.

Step-by-Step Setup Guide

Prerequisites

Before you begin, you'll need:

  • Salesforce account with API access (Professional edition or higher)
  • Doc Variables subscription (install from Google Workspace Marketplace)
  • Zapier account (free tier works for testing; paid for production)
  • A Google Docs template with Doc Variables placeholders

Step 1: Create Your Template in Google Docs

Build a document template with variables that match the data you'll pull from Salesforce. Use the ${Variable Name} syntax:

SERVICE AGREEMENT

This Agreement is entered into on ${Close Date::date::long} between:

${Your Company Name} ("Provider")
and
${Account Name} ("Client")

Client Contact: ${Contact Name}, ${Contact Title}
Client Email: ${Contact Email}
Client Address: ${Billing Street}, ${Billing City}, ${Billing State} ${Billing Zip}

SCOPE OF SERVICES
${Product Name}: ${Product Description}

COMPENSATION
Total Contract Value: $${Amount}
Payment Terms: ${Payment Terms::dropdown::Net 15,Net 30,Net 45,Due on Receipt}

TERM
This agreement begins on ${Close Date::date} and continues for ${Contract Term::dropdown::30 days,90 days,6 months,1 year}.

ACCEPTED AND AGREED:

_____________________________
${Contact Name}, ${Contact Title}
${Account Name}

_____________________________
${Owner Name}
${Your Company Name}

Pro tip: Name your variables to match Salesforce field names where possible—it makes mapping easier in Zapier.

Step 2: Connect Salesforce to Zapier

  1. Log into Zapier and click Create Zap
  2. Search for "Salesforce" as your trigger app
  3. Choose a trigger event:
    • New Record — Generate documents when records are created
    • Updated Record — Generate when specific fields change
    • New Record in View — Generate when records enter a specific view/filter
  4. Connect your Salesforce account (you'll need admin permissions or API credentials)
  5. Select the object to monitor (e.g., Opportunity, Account, Custom Object)
  6. For "Updated Record," specify which field change triggers the Zap (e.g., Stage equals "Closed Won")

Step 3: Add Filters (Optional but Recommended)

Not every Salesforce record should generate a document. Add a Zapier Filter step to control when documents are created:

  • Only closed-won deals: Stage equals "Closed Won"
  • Only deals above a threshold: Amount greater than $5,000
  • Only specific products: Product Name contains "Enterprise"
  • Only your territory: Owner ID equals your Salesforce user ID

Filters prevent unnecessary document generation and keep your Google Drive organized.

Step 4: Configure the Doc Variables Action

  1. Add a new action step in your Zap
  2. Search for "Doc Variables" and select it
  3. Choose the action: Replace Variables
  4. Connect your Google account
  5. Select your template document
  6. Map Salesforce fields to template variables:
Template VariableSalesforce Field
Account NameOpportunity → Account → Account Name
Contact NameOpportunity → Primary Contact → Full Name
Contact EmailOpportunity → Primary Contact → Email
AmountOpportunity → Amount
Close DateOpportunity → Close Date
Owner NameOpportunity → Owner → Full Name
Product NameOpportunity → Products → Product Name
  1. Set the output folder in Google Drive
  2. Configure file naming (e.g., "Contract - {Account Name} - {Close Date}")
  3. Optionally enable PDF export

Step 5: Add Follow-Up Actions (Optional)

After generating the document, chain additional Zapier actions:

  • Send for signature: Create a DocuSign or HelloSign envelope with the generated document
  • Email the sales rep: Send a Gmail notification with a link to the new document
  • Update Salesforce: Add a note to the Opportunity with the document link
  • Notify in Slack: Post to your sales channel that a contract was generated
  • Create a task: Add a follow-up task in Salesforce or Asana to review the document

Step 6: Test and Activate

  1. Click Test Zap in Zapier
  2. Zapier will pull a sample Opportunity from Salesforce
  3. Review the generated document—check that all variables replaced correctly
  4. If everything looks good, turn on your Zap

From now on, every qualifying Opportunity automatically generates a contract.

Advanced Configuration Tips

Handling Related Records

Salesforce data often spans multiple objects. To pull related data:

  • Use Zapier's "Find Record" action to look up related Contacts, Products, or custom objects
  • Chain multiple lookups before the Doc Variables action
  • Use Zapier's Formatter to combine or clean up data before insertion

Multi-Product Opportunities

If your Opportunities include multiple products, you have options:

  • Generate separate documents: Use Zapier's "Looping" feature to create a document for each product
  • Use a product table: Format product data as a list in Zapier, then insert as a single variable
  • Create summary variables: Use Salesforce formula fields to pre-format product lists

Conditional Content Based on Salesforce Data

Doc Variables supports conditional sections that show or hide content based on variable values:

?{${Product Type}(=)Enterprise::This Enterprise Agreement includes 24/7 premium support and dedicated account management.}

?{${Amount}(>)50000::As a strategic account, you are eligible for our Executive Business Review program.}

Different deal sizes, product types, or customer segments automatically get different contract language.

Calculated Fields

Perform calculations directly in your template:

${Amount}
${Discount Percent}
${Final Amount=Amount*(1-Discount Percent/100)}

If Salesforce doesn't have a calculated field you need, Doc Variables can compute it during document generation.

Common Use Cases

Use Case 1: Auto-Generate Contracts at Close

Trigger: Opportunity Stage changed to "Closed Won"

Action: Generate contract with account details, products, pricing, and terms

Follow-up: Send to DocuSign for signature, email link to sales rep

Result: Contract ready for signature within 60 seconds of closing the deal

Use Case 2: Proposal Generation from Qualified Opportunities

Trigger: Opportunity Stage changed to "Proposal"

Action: Generate proposal with company info, solution summary, and pricing

Follow-up: Email PDF to the primary contact, log activity in Salesforce

Result: Proposals sent immediately when deals reach proposal stage

Use Case 3: Renewal Agreements 90 Days Before Expiration

Trigger: Daily check for Opportunities with Close Date in 90 days (using Salesforce scheduled reports or Zapier's Schedule trigger)

Action: Generate renewal proposal with updated pricing and terms

Follow-up: Create task for account manager to review and send

Result: Proactive renewal outreach without manual tracking

Time and Error Savings

Sales teams using Salesforce + Doc Variables integration report:

  • 15-30 minutes saved per contract — multiply by your monthly deal volume
  • Zero data entry errors — no more typos in client names or wrong amounts
  • Faster deal velocity — contracts sent within minutes of verbal agreement
  • Consistent branding — every document follows the same professional template
  • Better compliance — approved language used automatically, no rogue edits

For a team closing 50 deals per month, that's 12-25 hours saved monthly—a full day or more of selling time recovered.

Getting Started

Ready to connect Salesforce to your Google Docs templates?

  1. Install Doc Variables from the Google Workspace Marketplace
  2. Create a template with variables matching your Salesforce fields
  3. Set up a Zap connecting Salesforce triggers to Doc Variables actions
  4. Test with a real Opportunity to verify the data flows correctly
  5. Turn it on and watch contracts generate themselves

The free Doc Variables tier includes 20 document generations—enough to prove the concept. Once you see a contract appear in your Drive 30 seconds after clicking "Closed Won," you'll wonder why you ever did it manually.


Doc Variables is the top-rated template automation add-on for Google Workspace, trusted by 160,000+ professionals who automate their document workflows. Integrates with Salesforce, HubSpot, Zapier, and more.

Ready to try Doc Variables?

Join 190,000+ users creating amazing Google Doc templates.

Install Now - It's Free