Google Sheets Rows to Product Images
Turn each row of a Google Sheet into a product image with n8n, Make or Zapier, and write the image link back into the row.
This recipe makes one image for each row in a Google Sheet and writes the image link back into that row. You fill in the product details, run the automation, and every row gets its own finished image.
It works with n8n, Make or Zapier. Pixmato does not have its own app inside those tools, so each recipe uses the tool’s general HTTP step to send a request to the Pixmato API (the address that makes images). Everything you need to paste is on this page.
What you need
- A Pixmato account with a template. The examples use a product card with three fields:
product,priceandphoto. - A Pixmato API key.
- A Google Sheet you can edit.
- An account with n8n, Make or Zapier.
Step 1: Get your API key
An API key is a password that lets the automation make images in your workspace.
- Open the Pixmato dashboard and go to API keys.
- Click Create API key, give it a name such as
Google Sheets, and create it. - Copy the key straight away. It is shown only once. Keys begin with
pxm_.
On this page the key is written as YOUR_API_KEY. Wherever you see it, paste your own key instead. Keep the key private: anyone who has it can make images that count against your plan. If it leaks, revoke it on the API keys page and create a new one.
Step 2: Get the template ID and field names
The template ID tells Pixmato which design to use. The field names say which parts of the design change for each row.
- Go to Templates in the dashboard.
- Open the menu on your template and choose Copy template ID. On this page it is written as
YOUR_TEMPLATE_ID. - Open the template’s details to see its field names under API parameters. You can also choose Test template and open the Use via API tab to see a complete request for that template.
Field names are case-sensitive. If your template calls the headline name instead of product, use name everywhere this page says product.
Step 3: Set up the sheet
Name the tab Products and put these column names in the first row, exactly as written:
| product | price | photo_url | image_url | render_id | status | error |
|---|---|---|---|---|---|---|
| Guji Highlands single origin, 250 g | £12.50 | https://cdn.fernhillcoffee.com/products/guji-highlands.jpg | ||||
| Fernhill house blend, 1 kg | £31.00 | https://cdn.fernhillcoffee.com/products/house-blend.jpg | ||||
| Kayon Mountain decaf, 250 g | £11.00 | https://cdn.fernhillcoffee.com/products/kayon-decaf.jpg |
You fill in the first three columns. Leave the last four empty: the automation writes them.
| Column | Who fills it | What it holds |
|---|---|---|
product |
You | Sent to the template field product. |
price |
You | Sent to the template field price. Text such as £12.50 is fine. |
photo_url |
You | Sent to the template field photo. It must be a full web address that opens without signing in. |
image_url |
The automation | The link to the finished image. A row with a link here is never sent again. |
render_id |
The automation | Pixmato’s ID for the image. Used to pick up an image that was still being made. |
status |
The automation | done, still rendering or failed. |
error |
The automation | Pixmato’s explanation when something went wrong, in plain words. |
To use more fields, add a column for each one and add a matching line to the request below.
The request every recipe sends
All three tools send the same request for each row. You will paste these values into the tool’s HTTP step.
| Setting | Value |
|---|---|
| Method | POST |
| URL | https://api.pixmato.com/v1/renders |
| Header | Authorization: Bearer YOUR_API_KEY |
| Header | Content-Type: application/json |
The body says which template to use and what to put in each field:
{
"template": "YOUR_TEMPLATE_ID",
"modifications": {
"product": "{{product}}",
"price": "{{price}}",
"photo": "{{photo_url}}"
},
"output": { "format": "png", "scale": 2 }
}
The parts in double curly brackets are placeholders for the row’s values. Each tool has its own way to insert them, shown in the steps below. modifications is the API’s word for field values. output asks for a PNG at twice the template’s size; leave it out to get the same result by default.
Pixmato waits until the image is finished (usually a second or two) and answers with:
{
"id": "rnd_01JY7R8Q7S2K3B4A5C6D7E8F9G",
"status": "completed",
"output_url": "https://storage.pixmato.com/workspaces/ws_01JY7R8Q7S2K3B4A5C6D7E8F9G/render-cache/v6-3f9c2a.png",
"duration_ms": 842,
"template": "YOUR_TEMPLATE_ID"
}
output_url is the image link that goes into the image_url column, and id goes into render_id. Anyone with the link can open the image, so you can paste it into a shop, an email or a social post.
n8n
Written for n8n 2.47. The workflow uses the Manual Trigger, Google Sheets (version 4.7), Filter, If, HTTP Request (version 4.2) and Switch nodes, which are all built into n8n.
- Download the workflow: n8n-google-sheets-product-images.json.
- In n8n, create a new workflow, open the … menu at the top right and choose Import from File. Pick the downloaded file. You can also choose Import from URL and paste
https://pixmato.com/docs/recipes/n8n-google-sheets-product-images.json. - Open the Render image node. Under Credential for Header Auth, choose Create new credential and enter:
- Name:
Authorization - Value:
Bearer YOUR_API_KEY(the wordBearer, a space, then your key)
- Name:
- Open the Check earlier render node and choose the same credential.
- Open each of the four Google Sheets nodes (Read product rows, Save image link, Save render ID to check later and Save error), connect your Google account, and choose your spreadsheet. The tab is already set to
Products. - In Render image, replace
YOUR_TEMPLATE_IDin the body with your template ID. If your field names differ fromproduct,priceandphoto, change them here too. - Click Execute workflow.
What the workflow does, node by node:
| Node | What it does |
|---|---|
| Read product rows | Reads every row of the Products tab. |
| Only rows without an image | Keeps rows whose image_url is empty. |
| Sent to Pixmato before? | Rows with a render_id go to Check earlier render; the rest go to Render image. |
| Render image | Sends the request above, one row at a time. |
| Check earlier render | Asks Pixmato for a render that was still being made last time, instead of starting again. |
| What happened? | Sends each answer to one of the three save steps. |
| Save image link | Writes image_url, render_id and status = done. |
| Save render ID to check later | Writes render_id and status = still rendering. |
| Save error | Writes status = failed and Pixmato’s message in error. |
The HTTP Request nodes have Never Error turned on, so a failed render is written into its row instead of stopping the whole run. To run the workflow on a timetable, replace Start with a Schedule Trigger.
Make
These steps use Make’s Google Sheets and HTTP apps. The numbers in values such as {{2.data.output_url}} are module numbers; Make shows them on each module, and yours may differ.
-
Create a scenario and add Google Sheets › Search Rows. Choose your spreadsheet and the
Productssheet, and set Table contains headers to Yes. -
Add HTTP › Make a request after it, and click the line between the two modules to add a filter named
Needs an imagewith two conditions joined by AND:image_urlDoes not exist, andrender_idDoes not exist. -
Fill in the HTTP module:
- Authentication type: API key. Create a keychain with Key
Bearer YOUR_API_KEY, API Key placement In the header, and API Key parameter nameAuthorization. - URL:
https://api.pixmato.com/v1/renders - Method: POST
- Body content type: application/json
- Body input method: JSON string
- Body content: paste the body below, then replace each placeholder by mapping the column from the Search Rows module.
- Parse response: Yes
- Under Advanced settings, set Return error if HTTP request fails to No and Timeout to
60.
{ "template": "YOUR_TEMPLATE_ID", "modifications": { "product": "{{1.product}}", "price": "{{1.price}}", "photo": "{{1.photo_url}}" }, "output": { "format": "png", "scale": 2 } } - Authentication type: API key. Create a keychain with Key
-
Add Google Sheets › Update a Row. Choose the same sheet, set Row number to the Search Rows module’s Row number, and map:
image_url:{{2.data.output_url}}render_id:{{if(2.statusCode = 200; 2.data.id; if(2.data.details.continues; 2.data.details.jobId; ""))}}status:{{if(2.statusCode = 200; "done"; if(2.data.details.continues; "still rendering"; "failed"))}}error:{{2.data.error}}
-
Click Run once.
A product name with a straight double quote (") in it breaks a JSON string body. If your sheet has those, build the body with JSON › Create JSON and map its output into Body content instead.
Rows marked still rendering are skipped by the filter in step 2. To finish them, add a second route with a Router: filter on render_id Exists and image_url Does not exist, then HTTP › Make a request with method GET, URL https://api.pixmato.com/v1/renders/{{1.render_id}} and the same keychain, then Update a Row with image_url set to {{get(get(5.data.outputs; 1); "url")}} and status set to {{if(5.data.status = "completed"; "done"; 5.data.status)}}.
Zapier
Webhooks by Zapier is available on paid Zapier plans. Zapier starts a Zap when a new row is added, so this Zap makes images for rows added after it is turned on.
-
Trigger: Google Sheets › New Spreadsheet Row. Choose your spreadsheet and the
Productsworksheet. -
Filter by Zapier: only continue if
image_urldoes not exist. -
Action: Webhooks by Zapier › POST:
-
URL:
https://api.pixmato.com/v1/renders -
Payload Type:
json -
Data: add one line for each value:
Key Value templateYOUR_TEMPLATE_IDmodifications__productthe product value from step 1 modifications__pricethe price value from step 1 modifications__photothe photo_url value from step 1 -
Headers:
Authorizationwith the valueBearer YOUR_API_KEY.
The double underscore puts the three fields inside
modifications, so Zapier sends this body:{ "template": "YOUR_TEMPLATE_ID", "modifications": { "product": "{{product}}", "price": "{{price}}", "photo": "{{photo_url}}" } } -
-
Action: Google Sheets › Update Spreadsheet Row. Set Row to the trigger’s Row ID,
image_urlto Output Url from step 3,render_idto ID from step 3, andstatustodone. -
Test each step, then publish the Zap.
When Pixmato answers with an error, Zapier stops the run at the POST step and shows Pixmato’s message in the Zap history. On plans that include it, open the … menu on the POST step and choose Add error handler, then add a Google Sheets › Update Spreadsheet Row step on the error path that writes failed to status and the error message to error.
When a render fails
Pixmato answers a failed request with an error code and a sentence that says what to change. For example, a row whose photo_url is house-blend.jpg instead of a full web address gets:
{
"code": "invalid_template_parameters",
"error": "Invalid template parameters. \"photo\": Must be a valid image URL or asset reference. Check the field keys and value types with GET /v1/templates/{id}.",
"status": 400,
"details": [{ "key": "photo", "message": "Must be a valid image URL or asset reference." }]
}
The n8n workflow and the Make scenario write the error sentence into the row, so you can see what to fix next to the data that caused it.
What you see in error |
Code | What to do |
|---|---|---|
| The API key is missing, invalid or revoked | unauthorized |
Check the Authorization value is Bearer, a space, then your key. |
| Template not found in this workspace | template_not_found |
Copy the template ID again, and use a key from the same workspace. |
| Invalid template parameters | invalid_template_parameters |
A column name or value does not match a template field. Fix the row. |
| Image could not be loaded | asset_unavailable |
Open photo_url in a private browser window; fix or replace the link. |
| Not enough render credits | credits_unavailable |
Wait for the monthly reset or upgrade the plan. |
| This workspace has reached its limit of 60 renders per minute | rate_limited |
Nothing to fix. Wait a minute and run the automation again. |
| The renderer could not create this image | render_failed |
Usually temporary. Run the automation again. |
Failed renders and refused requests do not use render credits. The full list of codes is in Errors.
A workspace can make 60 images a minute and have 10 in progress at once. A long sheet or a busy feed can reach that. The answer then has the status 429 and says how many seconds to wait. See Limits.
Running it again safely
Running the automation again is the way to retry. It is safe because of the columns the automation writes:
- Rows with an
image_urlare skipped. They never make a second image or use a second credit. - Rows marked
failedare sent again. Fix the row first if the error asks you to; if nothing needs fixing, the second try usually works. - Rows marked
still renderingare not sent again. Pixmato keeps working on an image even when it takes longer than the 30 seconds the request waits. The next run asks Pixmato for that render by itsrender_idand writes the link when it is ready.
Do not clear render_id on a row marked still rendering, and do not set up the tool to resend the request automatically when Pixmato takes too long. A second request makes a second image and uses a second credit. This is also why the Zapier recipe adds an error handler rather than relying on Zapier’s automatic replay.
Each finished image uses one render credit, even when the row’s values are the same as an earlier row. Empty image_url only on the rows you want made again.
What a second run does
Say the first run made images for the first two rows, the third row failed because its photo link was wrong, and you have since fixed that link and added a fourth product. On the second run:
- Rows one and two have an
image_url, so they are skipped. - Row three is sent again with the fixed link and gets its image.
- Row four is new, so it is sent and gets its image.
Only two new images are made, and only two credits are used.
Zapier works a little differently, because the Zap runs once for each new row rather than reading the whole sheet. Row four gets its image as soon as it is added. To retry row three, fix the link and then replay that row’s run from the Zap history. Do not replay a run whose error says the render is still processing: that image is still being made, and replaying it makes a second one. Find the finished image in Render history in the dashboard instead.