Validate email lists directly in your spreadsheets. Clean columns, verify form responses, and maintain list hygiene without leaving Google Sheets.
Connect Google Sheets to MailOdds using Google Apps Script, which is built into every spreadsheet.
In your Google Sheet, go to Extensions > Apps Script.
In the Apps Script editor, go to Project Settings > Script Properties. Add a property named MAILODDS_API_KEY with your API key as the value.
Copy one of the code examples below into the script editor and click Save.
Select the function from the dropdown and click Run. Authorize access when prompted.
Google Apps Script is built into every Google Sheet. Copy a function from the examples below, paste it into Extensions > Apps Script, and start validating in under 2 minutes.
View API DocumentationRun the script manually, or set up an onEdit or time-driven trigger to validate automatically when rows are added.
Apps Script calls the MailOdds API with UrlFetchApp.fetch() and receives status, action, and sub_status.
The script writes validation results back to adjacent columns on the same row.
Flag invalid emails with conditional formatting, or use MailApp.sendEmail() to alert on failures.
function validateEmails() {
var API_KEY = PropertiesService.getScriptProperties().getProperty('MAILODDS_API_KEY');
var sheet = SpreadsheetApp.getActiveSpreadsheet().getActiveSheet();
var emailCol = 1; // Column A
var statusCol = 2; // Column B
var actionCol = 3; // Column C
var subStatusCol = 4; // Column D
var lastRow = sheet.getLastRow();
for (var i = 2; i <= lastRow; i++) {
var email = sheet.getRange(i, emailCol).getValue();
if (!email) continue;
var response = UrlFetchApp.fetch('https://api.mailodds.com/v1/validate', {
method: 'post',
contentType: 'application/json',
headers: { 'Authorization': 'Bearer ' + API_KEY },
payload: JSON.stringify({ email: email })
});
var result = JSON.parse(response.getContentText());
sheet.getRange(i, statusCol).setValue(result.status);
sheet.getRange(i, actionCol).setValue(result.action);
sheet.getRange(i, subStatusCol).setValue(result.sub_status || '');
}
} function validateSingleEmail() {
var API_KEY = PropertiesService.getScriptProperties().getProperty('MAILODDS_API_KEY');
var sheet = SpreadsheetApp.getActiveSpreadsheet().getActiveSheet();
var row = sheet.getActiveCell().getRow();
var email = sheet.getRange(row, 1).getValue();
var response = UrlFetchApp.fetch('https://api.mailodds.com/v1/validate', {
method: 'post',
contentType: 'application/json',
headers: { 'Authorization': 'Bearer ' + API_KEY },
payload: JSON.stringify({ email: email })
});
var result = JSON.parse(response.getContentText());
sheet.getRange(row, 2).setValue(result.status);
sheet.getRange(row, 3).setValue(result.action);
sheet.getRange(row, 4).setValue(result.sub_status || '');
SpreadsheetApp.getUi().alert(
'Result: ' + result.action + ' (' + result.status + ')'
);
} Pull validation and engagement telemetry into Google Sheets using Apps Script. Call GET /v1/telemetry/summary and append a new row with totals, rates, and credit usage.
function importTelemetry() {
const API_KEY = PropertiesService.getScriptProperties().getProperty('MAILODDS_API_KEY');
const response = UrlFetchApp.fetch('https://api.mailodds.com/v1/telemetry/summary', {
headers: { 'Authorization': 'Bearer ' + API_KEY }
});
const data = JSON.parse(response.getContentText());
const sheet = SpreadsheetApp.getActiveSpreadsheet().getSheetByName('Telemetry');
sheet.appendRow([
new Date(),
data.totals.validations,
data.rates.deliverable,
data.totals.creditsUsed
]);
} After a bulk validation job completes, import the results into a Google Sheet. Each row includes the email, validation status, action, sub-status, and disposable flag.
function importBulkJobResults(jobId) {
const API_KEY = PropertiesService.getScriptProperties().getProperty('MAILODDS_API_KEY');
const response = UrlFetchApp.fetch(
'https://api.mailodds.com/v1/jobs/' + jobId + '/results',
{ headers: { 'Authorization': 'Bearer ' + API_KEY } }
);
const data = JSON.parse(response.getContentText());
const sheet = SpreadsheetApp.getActiveSpreadsheet().getSheetByName('Results');
// Write headers
sheet.getRange(1, 1, 1, 5).setValues([[
'Email', 'Status', 'Action', 'Sub-Status', 'Disposable'
]]);
// Write results
const rows = data.results.map(r => [
r.email, r.status, r.action, r.sub_status || '', r.disposable || false
]);
if (rows.length > 0) {
sheet.getRange(2, 1, rows.length, 5).setValues(rows);
}
} Set up a time-driven trigger in Apps Script to export weekly telemetry reports to a Google Sheet. The function runs on a schedule, fetches your summary data, and appends a row automatically.
// Google Apps Script: Weekly Report (time-driven trigger)
// Set up via Edit > Triggers > Add Trigger > weeklyReport > Time-driven > Weekly
function weeklyReport() {
var API_KEY = PropertiesService.getScriptProperties().getProperty('MAILODDS_API_KEY');
var response = UrlFetchApp.fetch('https://api.mailodds.com/v1/telemetry/summary', {
headers: { 'Authorization': 'Bearer ' + API_KEY }
});
var data = JSON.parse(response.getContentText());
var sheet = SpreadsheetApp.getActiveSpreadsheet().getSheetByName('Weekly Reports');
sheet.appendRow([
Utilities.formatDate(new Date(), Session.getScriptTimeZone(), 'yyyy-MM-dd'),
data.totals.validations,
data.rates.deliverable,
data.totals.creditsUsed,
data.totals.sent,
data.rates.open_rate,
data.rates.click_rate
]);
} MailOdds is a full-cycle email platform. After validating your Google Sheets contacts, you can send campaigns, monitor deliverability, and track engagement from the same API.
Can't find what you're looking for? We're here to help you get Google Sheets working.
Sign up free and get 1,000 validations to clean your Google Sheets data.