>_
SudoMock
Integration

Google Sheets Integration

Generate mockups directly from your Google Sheets. Perfect for bulk processing and team collaboration.

Bulk Processing Made Easy

List designs in a spreadsheet → Run script → Get mockup URLs in new column

Use Cases

Bulk Mockup Generation

Process hundreds of designs from a spreadsheet

Team Workflows

Share sheet with team, anyone can trigger generation

CSV Import

Import product list, generate all mockups at once

Reporting

Track mockup generation status and costs

Setup Guide

1

Prepare Your Spreadsheet

Create a Google Sheet with these columns:

  • A: Design URL — Public URL to your design image
  • B: Product Type — t-shirt, mug, poster, etc.
  • C: Mockup URL — Will be filled by script
  • D: Status — Processing status
2

Open Apps Script

Go to Extensions → Apps Script. This opens the script editor.

3

Add the Script

Replace the default code with:

Google Apps Script
1
// Google Apps Script for SudoMock Integration
2
const SUDOMOCK_API_KEY = 'YOUR_API_KEY';
3
const API_URL = 'https://api.sudomock.com/api/v1/renders';
4
5
// Template configuration
6
const TEMPLATES = {
7
't-shirt': { mockup_uuid: 'your-tshirt-uuid', smart_object_uuid: 'your-so-uuid' },
8
'mug': { mockup_uuid: 'your-mug-uuid', smart_object_uuid: 'your-so-uuid' },
9
'poster': { mockup_uuid: 'your-poster-uuid', smart_object_uuid: 'your-so-uuid' },
10
'hoodie': { mockup_uuid: 'your-hoodie-uuid', smart_object_uuid: 'your-so-uuid' }
11
};
12
13
/**
14
* Generate mockups for all rows with design URLs
15
* Run this function from the Apps Script editor
16
*/
17
function generateAllMockups() {
18
const sheet = SpreadsheetApp.getActiveSpreadsheet().getActiveSheet();
19
const data = sheet.getDataRange().getValues();
20
21
// Skip header row
22
for (let i = 1; i < data.length; i++) {
23
const designUrl = data[i][0];
24
const productType = data[i][1]?.toLowerCase();
25
const mockupUrl = data[i][2];
26
27
// Skip if no design URL or already processed
28
if (!designUrl || mockupUrl) continue;
29
30
// Update status
31
sheet.getRange(i + 1, 4).setValue('Processing...');
32
SpreadsheetApp.flush();
33
34
try {
35
const result = generateMockup(designUrl, productType);
36
sheet.getRange(i + 1, 3).setValue(result.mockupUrl);
37
sheet.getRange(i + 1, 4).setValue('Done');
38
} catch (error) {
39
sheet.getRange(i + 1, 4).setValue('Error: ' + error.message);
40
}
41
42
// Small delay to avoid rate limits
43
Utilities.sleep(500);
44
}
45
46
SpreadsheetApp.getUi().alert('Mockup generation complete!');
47
}
48
49
/**
50
* Generate a single mockup
51
*/
52
function generateMockup(designUrl, productType) {
53
const template = TEMPLATES[productType];
54
55
if (!template) {
56
throw new Error('Unknown product type: ' + productType);
57
}
58
59
const payload = {
60
mockup_uuid: template.mockup_uuid,
61
smart_objects: [{
62
uuid: template.smart_object_uuid,
63
asset: { url: designUrl }
64
}],
65
export_options: {
66
image_format: 'webp',
67
image_size: 2000,
68
quality: 95
69
}
70
};
71
72
const options = {
73
method: 'post',
74
contentType: 'application/json',
75
headers: {
76
'X-API-KEY': SUDOMOCK_API_KEY
77
},
78
payload: JSON.stringify(payload),
79
muteHttpExceptions: true
80
};
81
82
const response = UrlFetchApp.fetch(API_URL, options);
83
const result = JSON.parse(response.getContentText());
84
85
if (!result.success) {
86
throw new Error(result.detail || 'API error');
87
}
88
89
return {
90
mockupUrl: result.data.print_files[0].export_path
91
};
92
}
93
94
/**
95
* Add custom menu to spreadsheet
96
*/
97
function onOpen() {
98
SpreadsheetApp.getUi()
99
.createMenu('SudoMock')
100
.addItem('Generate All Mockups', 'generateAllMockups')
101
.addItem('Generate Selected Row', 'generateSelectedRow')
102
.addToUi();
103
}
104
105
/**
106
* Generate mockup for currently selected row
107
*/
108
function generateSelectedRow() {
109
const sheet = SpreadsheetApp.getActiveSpreadsheet().getActiveSheet();
110
const row = sheet.getActiveCell().getRow();
111
112
if (row === 1) {
113
SpreadsheetApp.getUi().alert('Please select a data row, not the header.');
114
return;
115
}
116
117
const designUrl = sheet.getRange(row, 1).getValue();
118
const productType = sheet.getRange(row, 2).getValue()?.toLowerCase();
119
120
if (!designUrl) {
121
SpreadsheetApp.getUi().alert('No design URL in selected row.');
122
return;
123
}
124
125
sheet.getRange(row, 4).setValue('Processing...');
126
127
try {
128
const result = generateMockup(designUrl, productType);
129
sheet.getRange(row, 3).setValue(result.mockupUrl);
130
sheet.getRange(row, 4).setValue('Done');
131
SpreadsheetApp.getUi().alert('Mockup generated successfully!');
132
} catch (error) {
133
sheet.getRange(row, 4).setValue('Error: ' + error.message);
134
SpreadsheetApp.getUi().alert('Error: ' + error.message);
135
}
136
}
4

Configure API Key

Replace YOUR_API_KEY with your SudoMock API key. Replace the template UUIDs with your actual mockup template IDs.

Security Note

For production use, store your API key in Script Properties instead of hardcoding:PropertiesService.getScriptProperties().setProperty('SUDOMOCK_API_KEY', 'your-key');
5

Run the Script

Save the script (Ctrl+S), then reload your spreadsheet. You'll see a new "SudoMock" menu. Click it to generate mockups.

Alternative: Using n8n

For more complex workflows, use n8n with Google Sheets trigger:

n8n Workflow
1
// n8n Workflow Structure
2
1. Google Sheets Trigger
3
- Trigger on: Row Added
4
- Sheet: Your product sheet
5
6
2. HTTP Request (SudoMock)
7
- POST https://api.sudomock.com/api/v1/renders
8
- Headers: X-API-KEY = {{ $credentials.sudomockApi.apiKey }}
9
- Body: Dynamic based on row data
10
11
3. Google Sheets Update
12
- Update row with mockup URL

Ready to Automate?

Get your API key and start generating mockups from Google Sheets.