Verify and clean email lists in Google Sheets
No extension and no subscription. Paste our Apps Script once, then use formulas like =OEV_VERIFY(A2) in any cell.
-
1
Open the script editor
In your spreadsheet, click Extensions in the top menu, then select Apps Script.
-
2
Paste the OpenEmailVerifier script
Replace everything in the
Code.gseditor with this script, then click Save (Ctrl+S / Cmd+S). Reload the sheet and use OpenEmailVerifier → Set API Key to store the key from your dashboard, or pass it as the second argument, for example=OEV_VERIFY(A2, "oev_live_...")./** * OpenEmailVerifier Google Sheets Apps Script Functions * https://openemailverifier.com * * Email verification and deliverability scoring inside Google Sheets. * * =OEV_VERIFY(A2) VALID, RISKY, INVALID or UNKNOWN * =OEV_IS_VALID(A2) TRUE or FALSE * =OEV_SCORE(A2) 0 - 100 * * Each function also takes a range (e.g. =OEV_VERIFY(A2:A200)); ranges are * sent to the batch endpoint, up to 100 addresses per request. * * Each verified address uses 1 credit from the account behind your API key * (new accounts get 500 free credits). Keys created without an account can * verify 500 addresses per day. Results are cached for 6 hours, and a cached * result is not charged again. */ var OEV_DEFAULT_ENDPOINT = "https://openemailverifier.com/api/v1/verify"; var OEV_BATCH_ENDPOINT = "https://openemailverifier.com/api/v1/verify/batch"; var OEV_ME_ENDPOINT = "https://openemailverifier.com/api/v1/integrations/me"; var OEV_BATCH_SIZE = 100; // The API accepts at most 100 addresses per batch request. var OEV_CACHE_SECONDS = 21600; // 6 hours /** * Creates custom OpenEmailVerifier menu when sheet opens. */ function onOpen() { var ui = SpreadsheetApp.getUi(); ui.createMenu('OpenEmailVerifier') .addItem('Set API Key', 'promptApiKey') .addItem('Check Credits Balance', 'checkCreditsBalance') .addToUi(); } /** * Prompt user to store their OpenEmailVerifier API key in user properties. */ function promptApiKey() { var ui = SpreadsheetApp.getUi(); var result = ui.prompt( 'OpenEmailVerifier API Key', 'Enter your API Key (e.g. oev_live_...):', ui.ButtonSet.OK_CANCEL ); if (result.getSelectedButton() == ui.Button.OK) { var key = result.getResponseText().trim(); PropertiesService.getUserProperties().setProperty('OEV_API_KEY', key); ui.alert('API Key saved successfully!'); } } /** * Show the credit balance (account keys) or today's free allowance (keys * without an account). */ function checkCreditsBalance() { var apiKey = getStoredApiKey(); var ui = SpreadsheetApp.getUi(); if (!apiKey) { ui.alert('No API key configured. Click "Set API Key" first.'); return; } try { var response = UrlFetchApp.fetch(OEV_ME_ENDPOINT, { method: "GET", headers: { "X-Api-Key": apiKey }, muteHttpExceptions: true }); var data = JSON.parse(response.getContentText()); if (!data.success) { ui.alert('Error checking balance: ' + (data.message || 'Invalid key')); } else if (data.account) { ui.alert('Credits Balance: ' + data.credits_balance + '\nPlan Tier: ' + (data.plan_tier || 'pay as you go')); } else { ui.alert('This key is not linked to an account.\nFree verifications left today: ' + data.anonymous_remaining_today + ' of ' + data.anonymous_daily_limit + '\nCreate a free account for 500 credits: https://openemailverifier.com/register'); } } catch (e) { ui.alert('Network error: ' + e.message); } } function getStoredApiKey() { return PropertiesService.getUserProperties().getProperty('OEV_API_KEY') || ""; } /** * Verify an email address (or a range). Returns VALID, RISKY, INVALID or UNKNOWN. * * @param {string|Array<Array<string>>} email Email address or range to verify. * @param {string} optApiKey Optional API key (defaults to stored key). * @return {string|Array<Array<string>>} VALID, RISKY, INVALID or UNKNOWN. * @customfunction */ function OEV_VERIFY(email, optApiKey) { return oevApply(email, optApiKey, "INVALID", function (data) { return (data.status || "INVALID").toUpperCase(); }); } /** * Check if an email (or a range) is deliverable and valid. Returns TRUE or FALSE. * * @param {string|Array<Array<string>>} email Email address or range to check. * @param {string} optApiKey Optional API key. * @return {boolean|Array<Array<boolean>>} True if deliverable, false otherwise. * @customfunction */ function OEV_IS_VALID(email, optApiKey) { return oevApply(email, optApiKey, false, function (data) { return data.is_valid === true || data.status === "valid"; }); } /** * Return deliverability quality score (0 to 100) for an email or a range. * * @param {string|Array<Array<string>>} email Email address or range. * @param {string} optApiKey Optional API key. * @return {number|Array<Array<number>>} Deliverability score 0 - 100. * @customfunction */ function OEV_SCORE(email, optApiKey) { return oevApply(email, optApiKey, 0, function (data) { return data.score || 0; }); } /** * Run a single cell through POST /verify, or a range through the batch * endpoint, and map each result with pick(). Cells without an "@" get * fallback (blank cells in a range stay blank) without using a credit. */ function oevApply(input, optApiKey, fallback, pick) { var apiKey = optApiKey || getStoredApiKey(); if (!Array.isArray(input)) { var email = oevNormalize(input); if (!email) return fallback; return pick(oevVerifySingle(email, apiKey)); } var emails = []; input.forEach(function (row) { row.forEach(function (cell) { var email = oevNormalize(cell); if (email) emails.push(email); }); }); var results = oevVerifyMany(emails, apiKey); return input.map(function (row) { return row.map(function (cell) { if (cell === "" || cell === null) return ""; // keep blank rows blank var email = oevNormalize(cell); if (!email || !results[email]) return fallback; return pick(results[email]); }); }); } function oevNormalize(value) { if (typeof value !== 'string') return ""; var email = value.trim(); return email.indexOf('@') === -1 ? "" : email; } function oevCacheKey(email) { return "oev_v2_" + email.toLowerCase(); } /** * Verify one address with POST /api/v1/verify (1 credit). */ function oevVerifySingle(email, apiKey) { var cache = CacheService.getScriptCache(); var cached = cache.get(oevCacheKey(email)); if (cached) { try { return JSON.parse(cached); } catch (e) {} } var body = oevPost(OEV_DEFAULT_ENDPOINT, { email: email }, apiKey); cache.put(oevCacheKey(email), JSON.stringify(body.data), OEV_CACHE_SECONDS); return body.data; } /** * Verify many addresses with POST /api/v1/verify/batch, 100 per request * (1 credit each). Returns results keyed by address. */ function oevVerifyMany(emails, apiKey) { var cache = CacheService.getScriptCache(); var results = {}; var pending = []; var seen = {}; emails.forEach(function (email) { if (seen[email]) return; seen[email] = true; var cached = cache.get(oevCacheKey(email)); if (cached) { try { results[email] = JSON.parse(cached); return; } catch (e) {} } pending.push(email); }); for (var i = 0; i < pending.length; i += OEV_BATCH_SIZE) { var chunk = pending.slice(i, i + OEV_BATCH_SIZE); var body = oevPost(OEV_BATCH_ENDPOINT, { emails: chunk }, apiKey); var data = body.data || []; var toCache = {}; // Results come back in the order the addresses were sent. chunk.forEach(function (email, index) { if (data[index]) { results[email] = data[index]; toCache[oevCacheKey(email)] = JSON.stringify(data[index]); } }); cache.putAll(toCache, OEV_CACHE_SECONDS); } return results; } /** * POST JSON to the API. Throws (shown as #ERROR! in the cell) when the key is * out of credits, over its daily allowance, rate limited or invalid. */ function oevPost(url, payload, apiKey) { var headers = { "Accept": "application/json" }; if (apiKey) headers["X-Api-Key"] = apiKey; var response = UrlFetchApp.fetch(url, { method: "POST", contentType: "application/json", headers: headers, payload: JSON.stringify(payload), muteHttpExceptions: true }); var body; try { body = JSON.parse(response.getContentText()); } catch (e) { throw new Error("OpenEmailVerifier: unexpected response (HTTP " + response.getResponseCode() + ")"); } if (!body || !body.success) { throw new Error("OpenEmailVerifier: " + ((body && body.message) || ("request failed (HTTP " + response.getResponseCode() + ")"))); } return body; } -
3
Use the formulas in any cell
Formula reference Formula Returns =OEV_VERIFY(A2) VALID, RISKY or INVALID =OEV_IS_VALID(A2) TRUE if deliverable, FALSE if not =OEV_SCORE(A2) Deliverability score from 0 to 100 Each formula also takes a range, for example
=OEV_VERIFY(A2:A500): the addresses are sent in batches of 100 and the results fill the cells next to them. Every address checked uses 1 credit; blank cells and cells without an@are skipped for free.