To create content in bulk with Google Sheets and ChatGPT, you put one keyword per row, write one prompt template, and let a short Apps Script send each row to the OpenAI API and write the answer back. By the end you will have a sheet that drafts product descriptions, FAQs or meta descriptions in batches, with status tracking, token counts and review checks.
Quick answer: Add the columns Keyword, Context, Prompt Template, Output, Status and Tokens to a tab named Content, store your OpenAI API key in Script Properties, paste the script below and run it from the custom menu. Each run fills up to 10 rows.
- Create a tab named Content with headers in A1:F1 and one keyword per row.
- Open Extensions > Apps Script and add a script property named openai_api_key.
- Paste the script, save, and reload the spreadsheet so the ChatGPT Bulk menu appears.
- Click ChatGPT Bulk > Generate (batch) and approve the permission prompt.
- Check that column D has text and column E says Done, then review before publishing.
In this guide
- Why Google Sheets + ChatGPT for bulk content
- What you’ll build: the bulk content pipeline (overview)
- Setup paths: API vs add‑ons
- Method 1: Apps Script + OpenAI API (step‑by‑step)
- Prompt template that scales
- Method 2: Formula‑first with an add‑on
- Rate limits, quotas, and reliability
- Quality control: keep it human and on‑brand
- Practical examples you can copy
- Exporting and publishing options
- Alternatives and complements
- Implementation guide: ship this in one afternoon
- Common errors and fixes
- Frequently Asked Questions
- Next steps
- Official docs and trusted sources
Why Google Sheets + ChatGPT for bulk content
Spreadsheets are the perfect control panel for content at scale: tabular data, simple formulas, filters, and collaboration. ChatGPT provides the language engine. Combine them and you get:
- Repeatable templates: lock tone, structure, and compliance with prompts.
- Speed with guardrails: generate 100s of items while keeping style consistent.
- Measurable throughput: rate‑limit safely, track tokens, and version your prompts.
- Simple handoff: export CSV to your CMS, or push to Docs/Drive in one click.
What you’ll build: the bulk content pipeline (overview)
We’ll create a sheet with these columns:
- A: Keyword/Topic (e.g., “wireless noise‑canceling headphones”)
- B: Context (brand, target audience, product specs)
- C: Prompt Template (one template for all rows)
- D: Output (ChatGPT result)
- E: Status (Pending, Done, Error: message)
- F: Tokens (approx usage per row)
A filled-in row looks like this before the first run (the template in C is the one from the “Prompt template that scales” section below):
| A: Keyword | B: Context | C: Prompt Template | D: Output | E: Status | F: Tokens | |
|---|---|---|---|---|---|---|
| 2 | wireless noise-canceling headphones | Commuters; 30-hour battery; USB-C charging | Write a 120–150 word product description… for {{keyword}}. Audience: {{context}}. … | (empty) | Pending | (empty) |
After a run, D holds the generated description, E changes to Done (or Error: … with the reason) and F shows how many tokens the request used. The script replaces {{keyword}} and {{context}} in the template with the values from A and B before sending it.
Setup paths: API vs add‑ons
- Apps Script + OpenAI API (recommended): Maximum control, better logging, portable. Works with team‑shared scripts and triggers.
- Marketplace add‑ons: Faster to start; less customizable. Search “GPT for Sheets” style add‑ons in the Google Workspace Marketplace and review their docs and permissions.
Method 1: Apps Script + OpenAI API (step‑by‑step)
- Open your Sheet → Extensions → Apps Script.
- Rename project to “Sheets‑ChatGPT Bulk”.
- Store your API key securely: Project Settings (gear icon) → Script properties → add a property with the name
openai_api_keyand your OpenAI key as the value. Create the key in your OpenAI account; API use is billed separately from a ChatGPT subscription. - Paste the script below and adjust the
SHEET_NAMEandMODELas needed.
/**
* Google Sheets + ChatGPT bulk generator
* Columns: A=Keyword, B=Context, C=Prompt Template, D=Output, E=Status, F=Tokens
*/
const SHEET_NAME = 'Content';
const START_ROW = 2; // header in row 1
const BATCH_SIZE = 10; // rows per run, to stay inside quotas and the 6-minute limit
// Use a current low-cost model from the OpenAI models page.
// Older names such as gpt-4o-mini are deprecated and get shut down.
const MODEL = 'gpt-6-luna';
function generateBulkContent() {
const lock = LockService.getScriptLock();
if (!lock.tryLock(1000)) return; // a previous run is still working
try {
const sheet = SpreadsheetApp.getActive().getSheetByName(SHEET_NAME);
if (!sheet) throw new Error('Missing sheet: ' + SHEET_NAME);
const lastRow = sheet.getLastRow();
if (lastRow < START_ROW) return;
const apiKey = PropertiesService.getScriptProperties().getProperty('openai_api_key');
if (!apiKey) throw new Error('Add openai_api_key in Script properties');
const values = sheet.getRange(START_ROW, 1, lastRow - START_ROW + 1, 5).getValues();
let processed = 0;
for (let i = 0; i < values.length && processed < BATCH_SIZE; i++) {
const [keyword, context, template, output, status] = values[i];
// Only process rows with inputs whose Status is blank or "Pending"
const state = String(status).toLowerCase();
if (!keyword || !template || (state && state !== 'pending')) continue;
processed++;
let result;
try {
const prompt = fillTemplate(template, { keyword, context });
const { text, tokens } = callOpenAI(apiKey, prompt);
result = [text, 'Done', tokens];
Utilities.sleep(600); // brief pause to be gentle on rate limits
} catch (e) {
result = [output, 'Error: ' + (e.message || e.toString()), ''];
Utilities.sleep(1500); // back off after an error
}
// Write only columns D:F of this row, so edits made to A:C during the run are kept
sheet.getRange(START_ROW + i, 4, 1, 3).setValues([result]);
}
} finally {
lock.releaseLock();
}
}
function fillTemplate(tpl, vars) {
return String(tpl)
.split('{{keyword}}').join(String(vars.keyword))
.split('{{context}}').join(String(vars.context || ''))
.trim();
}
function callOpenAI(apiKey, prompt) {
const url = 'https://api.openai.com/v1/chat/completions';
const payload = {
model: MODEL,
messages: [
{
role: 'developer',
content: 'You are a senior content editor. Be concise, factual, and brand-safe.'
},
{ role: 'user', content: prompt }
],
reasoning_effort: 'low', // short copy does not need deep reasoning
max_completion_tokens: 2000 // upper bound; includes reasoning tokens
};
const res = UrlFetchApp.fetch(url, {
method: 'post',
muteHttpExceptions: true,
contentType: 'application/json',
headers: { Authorization: 'Bearer ' + apiKey },
payload: JSON.stringify(payload)
});
const code = res.getResponseCode();
const body = res.getContentText();
if (code < 200 || code >= 300) {
throw new Error('API ' + code + ': ' + body.slice(0, 240));
}
const json = JSON.parse(body);
const text = (json.choices?.[0]?.message?.content || '').trim();
const totalTokens = json.usage?.total_tokens || '';
if (!text) throw new Error('Empty response');
return { text, tokens: totalTokens };
}
// Optional: custom menu
function onOpen() {
SpreadsheetApp.getUi()
.createMenu('ChatGPT Bulk')
.addItem('Generate (batch)', 'generateBulkContent')
.addToUi();
}First run and success check
- Save the script, then reload the spreadsheet tab. The ChatGPT Bulk menu appears next to Help, because
onOpen()only runs when the file opens. - Click ChatGPT Bulk > Generate (batch). The first time, Google asks you to authorize the script to edit the spreadsheet and connect to an external service; approve it and run the menu item again.
- Wait for the run to finish. Up to 10 rows should now show text in column D, Done in column E and a number in column F. Rows with an error show Error: and the API’s message in column E.
To run batches unattended, open Triggers (the clock icon) in the Apps Script editor, click Add Trigger, choose generateBulkContent, set the event source to Time-driven and pick an interval such as every 5 or 10 minutes. The script lock stops two runs from overlapping.
Prompt template that scales
Paste this into column C for all rows. Edit brand voice and length once—every row reuses it.
Write a 120–150 word product description in a friendly, expert tone for {{keyword}}.
Audience: {{context}}.
Include: a compelling opener, 3 bullet benefits, and a one-line CTA.
Constraints: no hype, no false claims, avoid jargon, use plain English.
Return only markdown with bullets.- Meta descriptions: 150–155 chars, include primary keyword, add soft CTA.
- FAQs (3 items): One line Q + 2–3 sentence answer each, avoid duplication.
- Feature tables: Return as pipe‑separated markdown rows to import elsewhere.
Method 2: Formula‑first with an add‑on
If you prefer a no‑code start, install a reputable “GPT for Sheets” style add‑on from Google Workspace Marketplace and use its formula, for example=GPT("Write a meta description for:", A2) (the exact syntax depends on the add-on). Pros: quick setup, inline formulas. Cons: harder to enforce rate limits, limited logging, and vendor lock‑in. Always review permissions and their documentation before use.
Rate limits, quotas, and reliability
- Batch size: Keep
BATCH_SIZEsmall (5–15). Schedule runs via triggers to clear queues gradually. - Backoff: On 429/5xx the sample script marks the row as Error, pauses, and moves on; clear the Status cell to retry it, or add retries with exponential backoff if you scale.
- Token budget: Track usage in column F. Shorten prompts and outputs to control costs and speed.
- Sheet protection: Lock columns C–F for editors only; prevent accidental edits mid‑run.
- Google Apps Script UrlFetchApp: developers.google.com/apps-script/reference/url-fetch/url-fetch-app
- Apps Script quotas: developers.google.com/apps-script/guides/services/quotas
- OpenAI API reference: platform.openai.com/docs/api-reference
Quality control: keep it human and on‑brand
- Style sheet: Put voice rules in the developer (system) message inside
callOpenAI(). Example: “Simple, confident, no superlatives, no exclamation points.” - Facts file: Add a short, structured context (column B) with specs you’ve verified. Avoid asking the model to invent data.
- Toxicity pass: Add a second prompt that audits the first output for policy or tone violations; flag rows needing review.
- Sampling: Manually review 10–20% of outputs each batch. Tighten prompts as issues emerge.
Practical examples you can copy
1) Product descriptions
Write a 120–150 word description for {{keyword}}. Audience: {{context}}.
Include 3 bullet benefits and a 10-word CTA. No fluff.2) 3‑pack FAQs
Create 3 FAQs for {{keyword}}. Audience: {{context}}.
Each Q on one line; answers 2–3 sentences; avoid overlap.3) Meta descriptions
Write a 150–155 character meta description for a page about {{keyword}}.
Include the keyword once and a gentle CTA. Return the text only.Exporting and publishing options
- Docs handoff: Use Apps Script to create one Google Doc per row and share with editors.
- CSV to CMS: File → Download → CSV and import via your CMS bulk editor.
- Apps Script → Drive: Save outputs as .md or .txt files in a folder for versioning.
Alternatives and complements
- Gemini for Workspace: Native to Google ecosystem; consider for internal documents and Slides.
- Claude/OpenRouter: Different model strengths; swap
callOpenAI()with your provider’s endpoint. - Zapier/Make: Trigger on new rows and push to Docs/Drive automatically.
Implementation guide: ship this in one afternoon
- Duplicate your Sheet; add the columns A–F and 10 sample rows.
- Paste the script, store the API key in Script properties, and run a test batch of 5.
- Tune the prompt once: voice, structure, and length constraints.
- Add a time‑based trigger (every 5–10 minutes) to process batches unattended.
- QA 20% of outputs; add fixes to the prompt; clear the Status of failed rows to re-run them.
- Export to Docs/CSV and hand off to your CMS with internal review.
Common errors and fixes
Error: API 401: the key is wrong, revoked or has a typo. Copy it again into theopenai_api_keyscript property.Error: API 429: you hit a rate limit, or the API account has no credit left (the message mentions your quota). LowerBATCH_SIZE, space out the trigger, or add credit in your OpenAI billing settings.Error: API 404mentioning the model: the model name inMODELis retired or not available to your account. Pick a current one from the OpenAI models page.Error: Empty response: the model used its whole token budget on reasoning before writing. Raisemax_completion_tokensor shorten the prompt.Missing sheet: ContentorAdd openai_api_key in Script properties: rename the tab to matchSHEET_NAME, or add the script property with exactly that name.- Nothing happens and no rows change: every row already has a Status other than blank or Pending, or A or C is empty. Clear the Status of the rows you want processed.
- “Exceeded maximum execution time”: one run hit the 6-minute Apps Script limit. Lower
BATCH_SIZEand let the trigger handle more runs.
Frequently Asked Questions
Can I run this without exposing my API key?
Yes. Store the key in Script Properties instead of a cell, so people who can only view the sheet never see it. Anyone with edit access to the script project can read script properties, so limit editors, and rotate the key in your OpenAI account if it leaks.
Which model should I use?
Pick the smallest, cheapest current model for short copy, and step up to a more capable one if your outputs are long or nuanced. Model names change and older ones are retired, so check the OpenAI models page before you set MODEL.
How much does bulk content generation cost?
It depends on the model and on the tokens each row uses, because the API is billed per token. Column F records the total tokens for every row, so run a test batch of 10, multiply by your model’s current per-token price, and scale from there. Shorter prompts and outputs cost less.
Will AI-generated content hurt SEO?
Thin, generic content can, whoever writes it. Use the sheet for first drafts, add facts only you have (specs, prices, test results) in column B, and have a person edit every piece before it goes live. Publishing hundreds of unreviewed pages is the risky part.
Can I do this without writing code?
Yes, with a Workspace Marketplace add-on that offers a GPT-style formula (Method 2 above). It is quicker to start, but you get less control over rate limits, logging and which data leaves your sheet. Check each add-on’s permissions and pricing before installing it.
Next steps
Run the script on five test rows, read every output and tighten the template before you fill the sheet. To feed it better inputs, pull product data from an API with ImportJSON for Google Sheets, or filter the rows you want to process with the QUERY function. If you would rather keep drafts on your own machine, see building a local AI content agent with Ollama and Node.js.
Official docs and trusted sources
- OpenAI API Reference: platform.openai.com/docs/api-reference
- OpenAI Safety & Usage Policies: openai.com/policies/usage-policies
- Google Apps Script UrlFetchApp: developers.google.com/apps-script/reference/url-fetch/url-fetch-app
- Apps Script Quotas: developers.google.com/apps-script/guides/services/quotas
- Google Workspace Marketplace: workspace.google.com/marketplace

