MailOdds

Google Sheets + MailOdds

Validate email lists directly in your spreadsheets. Clean columns, verify form responses, and maintain list hygiene without leaving Google Sheets.

Setup time: 5-10 min
Difficulty: Beginner
1,000 free validations included

Prerequisites

  • MailOdds account with API key
  • Google Sheets with email column
  • Access to Google Apps Script (built into Google Sheets)

How to Connect

Connect Google Sheets to MailOdds using Google Apps Script, which is built into every spreadsheet.

1

Open Apps Script

In your Google Sheet, go to Extensions > Apps Script.

2

Store your API key

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.

3

Paste a function

Copy one of the code examples below into the script editor and click Save.

4

Run the function

Select the function from the dropdown and click Run. Authorize access when prompted.

No Extra Tools Needed

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 Documentation

Example Workflow

1

Run or Trigger

Run the script manually, or set up an onEdit or time-driven trigger to validate automatically when rows are added.

2

Validate Email

Apps Script calls the MailOdds API with UrlFetchApp.fetch() and receives status, action, and sub_status.

3

Update Sheet

The script writes validation results back to adjacent columns on the same row.

4

Optional: Filter & Notify

Flag invalid emails with conditional formatting, or use MailApp.sendEmail() to alert on failures.

Apps Script: Validate All Rows

JAVASCRIPT
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 || '');
  }
}

Apps Script: Validate Active Row

JAVASCRIPT
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 + ')'
  );
}

Telemetry Export

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.

Apps Script: Import Telemetry Summary

JAVASCRIPT
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
  ]);
}

Bulk Results Export

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.

Apps Script: Import Bulk Job Results

JAVASCRIPT
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);
  }
}

Scheduled Report Template

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.

Apps Script: Weekly Report to Google Sheets

JAVASCRIPT
// 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
  ]);
}

Beyond Validation

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.

Frequently Asked Questions

Troubleshooting

Need more help?

Can't find what you're looking for? We're here to help you get Google Sheets working.

Start Validating Your Spreadsheet Emails

Sign up free and get 1,000 validations to clean your Google Sheets data.