If you store invoice, order, quote, or report data in Google Sheets, you can use Zapier and CraftMyPDF to automatically generate PDF documents without manually copying data into a document template.
In this tutorial, we will build a Zap that retrieves rows from Google Sheets, converts them into a JSON payload, and sends the data to CraftMyPDF to generate a PDF document from a reusable template.
This workflow is useful when your document has repeating data, such as invoice line items, order items, product lists, attendees, report sections, or table rows.

What we are building
In this guide, we will create a simple automation workflow:
Google Sheets → Zapier → Code by Zapier → CraftMyPDF → Generated PDF
Google Sheets will store the data. Zapier will retrieve the rows from the spreadsheet. Code by Zapier will convert the rows into a JSON payload. Finally, CraftMyPDF will use the JSON payload to generate a PDF from a template.
For example, you can use this workflow to generate:
- Invoices from order rows
- Quotes from product line items
- Reports from spreadsheet data
- Certificates from form submissions
- Order summaries from Google Sheets records
If you need a more flexible way to generate PDFs from structured data, CraftMyPDF also provides a PDF Generation API and a visual drag-and-drop PDF template editor.
Step 1: Prepare your Google Sheets data
Prepare your data and save the data on a Google spreadsheet. The data will be used for generating a PDF invoice.

Step 2. Create a CraftMyPDF PDF template
Create a PDF template on CraftMyPDF

The JSON data

Step 3. Zapier workflow
3.1. Create a Zap and setup a trigger
First, set up your trigger. For demo purposes, we will use the Zapier Chrome extension, you may use any event that starts your Zap.

3.2. Get data from Google Spreadsheet
3.2.1 Set up app & event
(i) Search for Google Sheets on Zapier and select Google Sheets
(ii) Select Get Many Spreadsheet Rows(Advanced, With Line Item Support) for Action Event and click Continue

3.2.2 Choose account
Connect your Google Sheets account to Zapier and click Continue

3.2.3 Set up the action
Now is to configure how you want to get the rows in the Google spreadsheet.
Select your Google drive and fill in all the required fields. In the Google spreadsheet, we enter the value 2 for the First Row, if you don’t have a header just set the value to 1. The max number of rows that can be retrieved is 20.

3.2.4 Test action
Now is the time to run and test the action. We will use raw_rows in the next action.

3.3. Building JSON string
We are going to use Code by Zapier to build the JSON string
3.3.1 Choose app & event
(i) First, search for Code by Zapier, select the option.
(ii) Then, select Run Javascript for the Action Event and press Continue

3.3.2 Set up action
In the Input Data section, provide the keys and values:
google_rows: bind the value to Raw Rows(Click on Get Many Spreadsheet Rows… and Show all options)
invoice_no: Invoice number or a value that you want to display in the PDF.

The following is the Javascript code that generate the JSON string.
let rows = JSON.parse(inputData.google_rows);
// Filter out rows that first cilumn is empty
rows = rows.filter((obj)=>obj[0].length>0);
// Create items
rows = rows.map((obj)=>{
return {
description: obj[0],
quantity: obj[1],
unit_price: obj[2],
total: obj[3]
}
});
// Serialize the object and return the JSON string
output = [{
output_json: JSON.stringify({
invoice_no: inputData.invoice_no,
items: rows
})}];
3.3.3 Test the action
Run and test the action, the action will produce a JSON string that can be used for CraftMyPDF.

3.4. Generate PDF with CraftMyPDF
3.4.1 Choose app & event
(i) First, search for CraftMyPDF, select the option.
(ii) Then, select Create PDF for the Action Event and press Continue

3.4.2 Choose account
Connect your CraftMyPDF account to Zapier and click Continue (To get the API Key, visit CraftMyPDF’s API Integration page)

3.4.3 Set up action
Select your PDF template and select JSON for the Payload Type.
In the JSON Payload field, select Output Json

3.4.4 Test the action
Run and test the action

Check that:
- The JSON payload is valid
- The PDF is generated successfully
If everything works, publish the Zap.
From now on, whenever the Zap runs, it will retrieve data from Google Sheets, build the JSON payload, and generate a PDF automatically with CraftMyPDF.
When to use a JSON payload for PDF generation
CraftMyPDF supports different ways to send data to a template. For simple documents, you can use a flat dictionary-style payload. For example:
{
"customer_name": "Acme Corp",
"invoice_no": "INV-1001",
"total": 299.00
}
This works well when your PDF only needs simple fields such as names, dates, addresses, and totals.
However, when your document contains repeating data, a JSON payload is usually a better option. For example, an invoice may contain multiple line items:
{
"invoice_no": "INV-1001",
"customer_name": "Acme Corp",
"items": [
{
"description": "Product A",
"quantity": 2,
"unit_price": 50,
"total": 100
},
{
"description": "Product B",
"quantity": 1,
"unit_price": 199,
"total": 199
}
]
}
This structure makes it easier to generate tables, repeat rows, and display dynamic data inside your PDF template.
Use JSON payloads when your document includes:
- Invoice line items
- Order items
- Product lists
- Report sections
- Multiple attendees
- Dynamic tables
- Nested data
In this tutorial, we will use a JSON payload because we want to send multiple spreadsheet rows into a PDF table.
Why use CraftMyPDF with Zapier and Google Sheets?
Google Sheets is great for storing and organizing data. Zapier is great for connecting apps and automating workflows. CraftMyPDF completes the workflow by turning your data into polished PDF documents.
With CraftMyPDF, you can create reusable PDF templates and generate documents automatically from Zapier. This is useful for invoices, quotes, reports, certificates, labels, order summaries, and other business documents.
Instead of manually copying data into Google Docs or editing PDFs one by one, you can design the template once and let Zapier handle the automation.
You can also use CraftMyPDF with other no-code and low-code tools such as Make.com, Airtable, Bubble, and API workflows.
Conclusion
That’s it. You now have a Zap that pulls data from Google Sheets, converts the rows into a JSON payload, and sends the data to CraftMyPDF to generate a PDF automatically.
This workflow is useful for invoices, quotes, order summaries, reports, certificates, and any document that needs repeating table data.
To try it yourself, create a free CraftMyPDF account, design a reusable PDF template, and connect it with Zapier.











