Created
May 5, 2021 05:57
-
-
Save imsurajkadam/9e5059ae3f122a1b14597273f69a771e to your computer and use it in GitHub Desktop.
Get keyword suggestions on Google Sheets with GrowKeywords.com
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// How to use: | |
// Create a script on Google Sheets | |
// Copy this script and fill your email and api key (optional) | |
// Save and run the script | |
// In Google Sheets put a keyword on a cell and select that cell | |
// Use the new menu called on Google Sheets with SEO Ruler -> Keyword Ideas | |
// Leave EMAIL and API_KEY blank for free API calls | |
// Please do not abuse the API so we can keep it free | |
const SEO_RULER_EMAIL = ""; | |
const SEO_RULER_API_KEY = ""; | |
const MAX_KEYWORDS = '5000'; // Max is 5000 | |
function onOpen() { | |
var ui = SpreadsheetApp.getUi(); | |
ui.createMenu('SEO Ruler') | |
.addItem('Keyword Ideas', 'seoRulerSuggest') | |
.addToUi(); | |
} | |
function seoRulerSuggest() { | |
var sheet = SpreadsheetApp.getActiveSheet(); | |
var seed = sheet.getActiveCell().getValue(); | |
var response = UrlFetchApp.fetch(`https://growkeywords.com/api/suggest?query=${seed}&max=${MAX_KEYWORDS}&token=${SEO_RULER_API_KEY}&email=${SEO_RULER_EMAIL}`); | |
var json = response.getContentText(); | |
var data = JSON.parse(json); | |
var cell = sheet.getCurrentCell(); | |
sheet.getRange(cell.getRow()+1, cell.getColumn(), data.suggestions.length, 1).setValues(data.suggestions.map((s) => [s])); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment