To automate keyword research, connect a Google Sheet to a keyword data API, have a script pull suggestions and volumes for your seed terms on a schedule, add the queries Search Console already shows for your site, then filter and group the rows by rule. AI can help with the grouping and the labels, but it should never be the source of a search volume.
The part you can’t automate is the decision: which keywords deserve a page. The setup below takes about an hour, runs on free Google tools plus a pay-as-you-go API, and leaves you with a sheet you review for ten minutes instead of building from scratch every month.
Throughout, the example is a made-up veterinary clinic in Austin, Texas that wants blog topics and service pages its owners will actually search for.
What to have ready
- A Google account and a blank Google Sheet. The scripts run in Apps Script, which is built into Sheets.
- A keyword data source with an API. This guide uses DataForSEO, which bills per request with no monthly plan. Its keyword suggestions endpoint returns phrases that contain your seed, each with search volume, keyword difficulty (0 to 100), main intent and cost per click. In our own runs in November 2026, one request for 100 US suggestions cost about 2 cents.
- A verified Search Console property for the site, so the script can read your own queries.
- Your seed list. Write it yourself, from your services and the questions customers ask. For the vet clinic: “dog vaccinations”, “cat dental cleaning”, “puppy shots schedule”, “spay and neuter”. If you’re unsure how to build one, our keyword research template shows the columns and a priority score you can reuse.
Why not Google’s own data? Keyword Planner’s numbers come through the Google Ads API’s KeywordPlanIdeaService, which takes up to 20 seed keywords or a URL and returns average monthly searches, competition and bid ranges. But Google lists planning services as unavailable at the Explorer access level, so you need Basic access, which now requires brand verification of your Google Cloud project before you can apply. That page also says developer tokens were sunset on September 9, 2026, with access managed per Cloud project instead. It’s worth it for an agency. For one business, a paid API is the faster route. If you only need a few lookups a month, our list of free keyword research tools covers what Keyword Planner gives you by hand.
How to set up automated keyword research
- Lay out the sheet. Make three tabs:
Seeds(one term per row in column A),Ideas(where the API rows land) andGSC(your Search Console queries). - Store the API key out of the code. In the sheet, open Extensions, then Apps Script. Go to Project Settings, then Script Properties, and add a property called
DFS_AUTHholding your DataForSEO login and password Base64-encoded aslogin:password. Anyone who can edit the script can read it, so share the sheet with care. - Paste the pull script (below) and run
pullIdeasonce by hand. Approve the access prompt. TheIdeastab should fill with rows. - Filter by rule, in the script, not by eye. The script keeps rows with volume of at least 50 and difficulty under 35 and drops navigational intent. Change those numbers to suit your site. A new site should keep the difficulty cap low.
- Add your own queries. Run the Search Console function so the
GSCtab lists queries with impressions over the last 90 days. Rows that appear in both tabs are where you already have a foothold. - Schedule it. Run
createTriggersonce. It sets the pull to run monthly. Apps Script time triggers can run from every minute to once a month, and Google warns the start time is loose: a 9 am trigger may fire any time before 10 am. - Group and review. Once the rows are in, sort them into topics (next section) and mark which ones get a page.
Step 4 matters most. Most keyword lists fail because nobody cuts them. A rule you set once (volume floor, difficulty cap, intent) does the cutting every month without second thoughts, and you only review what survives.
The pull script. Change the location code if you’re not targeting the US (2840 is the United States):
const LOCATION = 2840; // United States
const MIN_VOLUME = 50;
const MAX_KD = 35;
function pullIdeas() {
const ss = SpreadsheetApp.getActiveSpreadsheet();
const seeds = ss.getSheetByName('Seeds').getRange('A1:A').getValues()
.flat().filter(String);
const auth = PropertiesService.getScriptProperties().getProperty('DFS_AUTH');
const out = [];
const today = new Date();
seeds.forEach((seed) => {
const res = UrlFetchApp.fetch(
'https://api.dataforseo.com/v3/dataforseo_labs/google/keyword_suggestions/live', {
method: 'post',
contentType: 'application/json',
headers: { Authorization: 'Basic ' + auth },
payload: JSON.stringify([{ keyword: seed, location_code: LOCATION,
language_code: 'en', limit: 100 }]),
});
const items = JSON.parse(res.getContentText()).tasks[0].result[0].items || [];
items.forEach((it) => {
const vol = it.keyword_info.search_volume || 0;
const kd = it.keyword_properties.keyword_difficulty;
const intent = (it.search_intent_info || {}).main_intent || '';
if (vol >= MIN_VOLUME && (kd == null || kd < MAX_KD) && intent !== 'navigational') {
out.push([today, seed, it.keyword, vol, kd, intent, it.keyword_info.cpc]);
}
});
});
if (out.length) {
const sheet = ss.getSheetByName('Ideas');
sheet.getRange(sheet.getLastRow() + 1, 1, out.length, 7).setValues(out);
}
}
For the Search Console tab, add this function and set SITE to your property, with sc-domain: in front for a Domain property:
const SITE = 'sc-domain:example.com';
function pullGsc() {
const tz = Session.getScriptTimeZone();
const end = new Date();
const start = new Date(end.getTime() - 90 * 864e5);
const res = UrlFetchApp.fetch('https://www.googleapis.com/webmasters/v3/sites/' +
encodeURIComponent(SITE) + '/searchAnalytics/query', {
method: 'post',
contentType: 'application/json',
headers: { Authorization: 'Bearer ' + ScriptApp.getOAuthToken() },
payload: JSON.stringify({
startDate: Utilities.formatDate(start, tz, 'yyyy-MM-dd'),
endDate: Utilities.formatDate(end, tz, 'yyyy-MM-dd'),
dimensions: ['query'], rowLimit: 25000 }),
});
const rows = (JSON.parse(res.getContentText()).rows || [])
.map((r) => [r.keys[0], r.impressions, r.clicks, r.position]);
const sheet = SpreadsheetApp.getActiveSpreadsheet().getSheetByName('GSC');
sheet.clearContents();
if (rows.length) sheet.getRange(1, 1, rows.length, 4).setValues(rows);
}
function createTriggers() {
ScriptApp.newTrigger('pullIdeas').timeBased().onMonthDay(2).atHour(6).create();
ScriptApp.newTrigger('pullGsc').timeBased().onMonthDay(2).atHour(7).create();
}
The Search Console call needs the API turned on in a standard Cloud project and the webmasters.readonly scope, the same setup our automated SEO reporting guide walks through step by step. The searchAnalytics.query reference caps one request at 25,000 rows (the default is 1,000) and says it returns top rows, not every row, so a large site sees its biggest queries, not the long tail. If you’d rather ask an AI assistant about those queries directly, our comparison of Search Console MCP servers covers that route.
Group the keywords without guessing
A raw pull for 20 seeds can return hundreds of rows, many of them the same question in different words. “Puppy shots schedule” and “when do puppies get shots” need one page, not two. There are three ways to group them, from cheapest to most reliable.
Word rules. Sort by a shared head term (“puppy”, “dental”, “spay”) with a FILTER or REGEXMATCH formula. It’s free and instant, but it can’t tell that “cost of spaying a cat” and “cat neuter price” belong together.
AI labels. Paste the keyword column (just the words, no numbers) into a chat assistant and ask it to sort them into topics and name each group. This is where AI earns its place: it is quick at spotting that two phrasings ask the same thing. Then check the groups yourself, because the output can be wrong in a confident tone. OpenAI’s own help page says ChatGPT can produce incorrect or misleading outputs and advises you to verify data.
SERP overlap. For the groups you’re unsure about, pull the live top 10 for each keyword from a SERP API and treat two keywords as one page when several of the same URLs rank for both. Google has already decided they’re one topic. It costs money per keyword (about a fifth of a cent per query in our November 2026 runs with DataForSEO), so save it for the borderline cases rather than the whole list.
Where AI helps, and where it makes things up
Ask a general chat assistant for “keywords with search volume” and it will often hand you a neat table. Unless the assistant is connected to a keyword data tool and tells you which one, treat those numbers as made up. The model is predicting plausible text, and a plausible volume looks exactly like a real one. That is the single biggest risk in using AI for keyword research.
Good uses:
- Seed ideas. “List the questions a dog owner asks before a first vet visit” gives you phrasing to test. The API then tells you which ones anyone searches.
- Grouping and naming, as above.
- Intent checks on edge cases, such as whether “vet near me open now” is a page you can win with a blog post (it isn’t, it’s a Maps search).
Bad uses: search volumes, difficulty scores, trends and “what competitors rank for”, unless the numbers come from a tool call you can see. If you need competitor data, pull it from an API or follow the manual method in our competitive keyword research guide.
What can go wrong
- The numbers don’t match Keyword Planner. They won’t exactly. Google’s own help says Keyword Planner volumes are rounded and include close variants, averaged over 12 months. Third-party tools model their own figures. Compare keywords within one tool, not across tools.
- The script times out. Apps Script stops a run after 6 minutes, and a consumer account gets 90 minutes of trigger runtime a day. Twenty seeds finish well inside that. Two hundred seeds for several clients may not, so split them across sheets or days.
- Duplicates pile up.
pullIdeasappends, so each month adds a fresh copy of keywords you’ve already seen. That’s useful as a history, but filter theIdeastab by the latest date when you review, or add a step that skips keywords already marked. - Cost creeps. Each seed is one paid request. Keep the seed list short and deliberate. A long list of near-duplicate seeds returns the same suggestions several times over.
- Nobody reviews it. A sheet that fills itself every month and never gets read is just a bill. Put the ten-minute review in your calendar for the day after the trigger runs.
When a group earns a page, turn it into a brief straight away. Our content brief template takes a keyword group and turns it into a plan a writer can follow.
FAQ
Can AI do keyword research on its own?
It can suggest phrasings and group keywords well, but a chat model without a connected data tool has no reliable search volumes. Use an API or Keyword Planner for the numbers and let AI handle the sorting.
Is there a free way to automate keyword research?
Partly. The Search Console part of this setup is free and shows real queries for your own site. Search volumes for new keywords need either Keyword Planner by hand or the Google Ads API with Basic access, or a paid API that bills per request.
How often should automated keyword research run?
Monthly suits most small businesses, since keyword volumes are monthly figures and your page plans won’t change faster than that. Weekly only makes sense if you publish several pages a week.
Let the sheet fill itself, then make the calls
Set up the two scripts, cut the list by rule, and use AI to name the groups, not to invent the numbers. What you get each month is a short list of keywords with sourced figures, and the only job left for you is deciding which ones deserve a page.
