(+91)7275894867 [email protected]
OutRightCRM Login
📅 Published on August 16, 2024 ✏️ Updated on April 22, 2025

Easiest Way to Integrate Moz to Google Spreadsheets Using Free Apps Script

Author Avatar
Author
Editorial Team

Easiest Way to Integrate Moz to Google Spreadsheets Using Free Apps Script

The easiest way to integrate Moz with Google Spreadsheets is by using a free Google Apps Script. Enter your Moz Access ID and Secret Key, then use the script to call Moz’s API. Automatically fetch metrics like DA, PA, and backlinks into your sheet for quick SEO analysis and tracking.
  1. Step 1: Click on the Copy button to copy the code snippet.
  2. Step 2: Paste the copied code into your project’s script editor.

Apps Scripts Blog

Read Blog

Apps Scripts Code

function fetchMozMetrics() {
  var mozApiKey = "mozscape-Pxnjj9jfr3";
  var mozAccessId = "";
  var mozSecretKey = "czIyzlsjg0NmlG2oZ7rV0V8JLAC7TcR6";
  var url = "https://api.moz.com/url-metrics";
 
  // Specify the URL for which you want to fetch metrics
  var targetUrl = "https://www.google.com";
 
  var payload = {
    "urls": [targetUrl],
    "access_id": mozAccessId,
    "secret_key": mozSecretKey
  };
 
  var options = {
    "method": "post",
    "contentType": "application/json",
    "payload": JSON.stringify(payload),
    "headers": {
      "X-Moz-Token": mozApiKey
    }
  };
 
  // Make the API request
  var response = UrlFetchApp.fetch(url, options);
  var responseData = JSON.parse(response.getContentText());
 
  // Extract relevant metrics
  var metrics = {
    "URL": responseData[0].uu,
    "Title": responseData[0].ut,
    "Domain Authority": responseData[0].pda,
    "Page Authority": responseData[0].upa,
    "External Links": responseData[0].ueid,
    "Linking Root Domains": responseData[0].uid,
    "MozRank": responseData[0].umrp,
    "MozTrust": responseData[0].fmrp
  };
 
  // Write metrics to the Google Sheet
  var sheet = SpreadsheetApp.getActiveSpreadsheet().getActiveSheet();
  var headers = Object.keys(metrics);
  var headerRow = headers.map(function(header) {
    return metrics[header];
  });
  sheet.appendRow(headerRow);
}

Scroll to Top