Skip to main content

Generate a contract from an Airtable record with n8n

Mark a record Ready in Airtable and the workflow builds the contract from your Google Docs template, saves the Doc and a PDF to Google Drive, and writes the link back to the record.

Source
Airtable
Output
Google DocsPDF (single runs only)
Delivered to
Google Drive

n8n workflow

The importable workflow file for this recipe is being tested and will be added here. The steps below show exactly what it does, so you can build it now in a few minutes with the SourceToDocs n8n node.

How the workflow runs

  1. 01

    Airtable Trigger: records marked Ready

    Polls the Contracts table, sorted by a Last Modified Time field, and a formula keeps only the records whose Status is Ready.

  2. 02

    Loop Over Items: Batch Size 1

    The SourceToDocs node starts one run for all the items it receives. The loop hands it one record at a time, so two records marked Ready together still get one contract each.

  3. 03

    SourceToDocs: Document, Generate

    Rows Come From is set to the Map Columns mode. The parties, services, fee and terms come from the record; Effective date is the day the workflow runs. Because this is a single run, switching on Also generate PDF delivers a PDF beside the Google Doc.

  4. 04

    Airtable: Record, Update

    Writes file_url into the Contract link field and changes Status, which also stops the same record from being generated twice.

Airtable fields and the template placeholders they fill
Airtable field Template placeholder
Client legal name {{ client_legal_name }}
Client address {{ client_address }}
Services {{ services }}
Fee {{ fee }}
Payment terms {{ payment_terms }}
Start date {{ start_date }}
Signatory {{ signatory }}
(run date) {{ effective_date }}

Or have Claude set it up

The Proposals, quotes and contracts skill works through the SourceToDocs connector at https://app.sourcetodocs.com/api/mcp. Install the skill, connect, then paste:

Use the sales-documents skill. My contracts are in the Airtable base "Sales", table "Contracts", one record per contract, with the fields Client legal name, Client address, Services, Fee, Payment terms, Start date and Signatory. Set up a Google Docs contract document on that table with a PDF next to the Doc. I will pick the contract template and the Drive folder "Contracts" when you send me the links. Show me the placeholder mapping before you run anything. Then ask me which record to generate, and run that one record only, as a Doc with a PDF.

Get the skill file

To build an Airtable contract generator with n8n, poll the table for records marked Ready, pass each record’s fields to the SourceToDocs node to fill your Google Docs contract template, and write the returned link back to the record. One record is one run, so SourceToDocs can deliver a PDF next to the Google Doc. The build is four nodes, described below.

What you need

  • An Airtable table, here called Contracts, with one record per contract and the fields Client legal name, Client address, Services, Fee, Payment terms, Start date, Signatory, Status (single select with at least Ready and Generated) and Contract link (URL).
  • One more field in that table, Status changed, of type Last Modified Time and set to watch only the Status field. The trigger needs a time field to sort by.
  • A contract template in Google Docs with your own wording and the placeholders {{ client_legal_name }}, {{ client_address }}, {{ services }}, {{ fee }}, {{ payment_terms }}, {{ start_date }}, {{ signatory }} and {{ effective_date }}. The contract template is a fuller design with its own placeholder names: a design reference, not a drop-in file. The legal text is yours; the workflow only fills in the fields.
  • A SourceToDocs workspace and an API token for it. A workspace owner or admin creates the token on the API Tokens page.
  • On the Accounts page, a Google Docs connection for the template and a Google Drive connection for delivery. Every tile is a separate connection: Google Slides or Google Drive does not cover Google Docs.
  • n8n, self-hosted or Cloud, with the SourceToDocs node installed. In n8n, open Settings, then Community nodes, and install @twovmodules/n8n-nodes-sourcetodocs. On n8n Cloud, add it from the nodes panel, where it is listed as a verified node.
  • An Airtable credential in n8n, Access Token or OAuth2, that can read and write the base.

Set up the document in SourceToDocs

The template and its settings live in SourceToDocs. n8n only sends the record.

  1. Create a Google Docs document.
  2. Upload a small CSV with the header row Client legal name, Client address, Services, Fee, Payment terms, Start date, Signatory, Effective date and one sample line as the data source; it becomes a data set. The sample is enough, because the workflow sends the real record in place of reading the source.
  3. Each column gets an alias, a snake-case identifier derived from its name. The template uses the alias: column Client legal name is {{ client_legal_name }}.
  4. On the Document step, pick your Google Doc. Its Variables panel lists the exact placeholders for your data set; click one to copy it.
  5. Add a Google Drive distribution and choose the folder.
  6. Switch on Also generate PDF in the Output card.
  7. Leave split off. A split document produces no PDFs.

You can connect the Contracts table as the data source in place of the CSV. The workflow still sends the one record it is handling, and the node’s column list then shows the table’s own columns. In that case add Effective date to the table as well, or drop it from the template.

Build it in n8n

Add the nodes in this order. Connect the trigger to Loop Over Items, the loop output to SourceToDocs, SourceToDocs to the Airtable node, and that node back into Loop Over Items.

NodeOperationKey settings
Airtable TriggerPolls on the schedule you set under Poll TimesBase and Table: your Contracts table. Trigger Field: Status changed. Under Additional Fields, Formula: {Status} = 'Ready', and Fields: the seven content fields, comma separated.
Loop Over ItemsBatch Size: 1No other settings.
SourceToDocsResource: Document. Operation: GenerateDocument: your contract document. Rows Come From: This Workflow — Map Columns. Data Set: the one with the eight columns. Columns: see below. Wait for Completion stays on, which is the default.
AirtableResource: Record. Operation: UpdateBase and Table: the same Contracts table. Column to match on: id. Values: see below.

The eight column values in the SourceToDocs node:

ColumnValue
Client legal name{{ $json.fields['Client legal name'] }}
Client address{{ $json.fields['Client address'] }}
Services{{ $json.fields['Services'] }}
Fee{{ $json.fields['Fee'] }}
Payment terms{{ $json.fields['Payment terms'] }}
Start date{{ $json.fields['Start date'] }}
Signatory{{ $json.fields['Signatory'] }}
Effective date{{ $now.toFormat('d LLLL yyyy') }}

The values the Airtable node writes:

ColumnValue
id{{ $('Loop Over Items').item.json.id }}
Contract link{{ $json.file_url }}
StatusGenerated

The trigger outputs each record with its ID at the top level and its values under fields. If your output panel shows another shape, drag the values from it into the columns. The Column names in the SourceToDocs node are the data set’s column names, case included, not the template placeholders, which use the aliases.

Mapped values are sent as they resolve. Airtable returns a date as 2026-11-14 and a currency field as a bare number, so format Start date and Fee in the expression, or keep a formula field in Airtable that holds the text the way it should read in the contract.

The SourceToDocs node returns file_url and file_name at the top level of its output, and that link to the Google Doc is what the last node writes. With Also generate PDF on, the deliveries list in the same output holds one entry per destination, and a Google Drive entry’s result carries drive_url for the Doc and pdf_url for the PDF. To keep both links, add a Contract PDF field to the table and set it to {{ $json.deliveries[0].result.pdf_url }}.

Set it up with Claude instead

The sales-documents skill lets Claude do the SourceToDocs part for you through the MCP connector. Here it can work on the base directly: it creates the document, attaches the Contracts table through your connected Airtable account, reads the template’s placeholders and shows you how they map to the fields, sets the Google Drive delivery with a PDF, and starts a run for the record you name. It sends that one record’s row with the run, so the run stays a single run and the PDF is delivered with the Doc. You connect the accounts and pick the template file and the Drive folder yourself, through links Claude hands you, and Claude cannot edit the template.

The limit is timing. Claude acts when you ask; it does not watch the base for a record turning Ready, and it does not write the link back into Airtable through SourceToDocs. It also prints what the record holds: filling Effective date with the run day is something the n8n build does, so for this route add an Effective date field to the table or leave that placeholder out of the template. Use it to set the document up and to produce contracts on request, and use the n8n workflow above, on the same document, for the automatic part.

When an Airtable automation is enough

A contract of a few lines can be built without an external generator at all, with an Airtable automation that creates a Google Doc from the record. The workflow on this page is for contracts that have to keep the layout of a real Google Docs template, numbered clauses and signature blocks included, and arrive as a PDF. The n8n node page lists what the SourceToDocs node does in a workflow.

Where this fits

A record, a template and a destination: contracts are one case of a pattern that covers most documents generated from a base. The Airtable document automation guide covers the schema and the approaches behind it, and the automations library has the neighbouring recipes.

Related

Common questions, answered

Is there a workflow file to import? +
Not yet. The importable file is being tested and will be added to this page. Until then, the four nodes and their settings above are everything the workflow contains, so you can build it by hand.
Does it collect signatures? +
No. The workflow produces the contract as a Google Doc and a PDF in Google Drive and writes the link to the record. Hand the PDF to your signing tool, by hand or with a further n8n node for that tool.
Can clauses change with the kind of contract? +
Yes. Keep the clauses as records in a linked table, add them as a second data set in SourceToDocs and loop over it in the template. In the n8n node, send the clause rows for this contract as a JSON array under Options, Additional Data Sets. Text that is the same in every contract belongs in the template itself.
What stops a record from generating twice? +
The last node changes Status away from Ready, and the trigger's formula only returns Ready records. To regenerate a contract after editing the record, set Status back to Ready.
Can SourceToDocs read the Airtable base itself, without n8n? +
Yes. A document can read its rows from a connected Airtable base. A run you start in the app reads the table as it stands, so one contract per record that way means a split document, which delivers Google Docs and no PDFs. A run started by n8n or by Claude can carry one record's row instead, which keeps it a single run with a PDF. n8n is what adds the reaction to a record being marked Ready and the link written back.