How to monitor domain expiry in Google Sheets in bulk

How to monitor domain expiry in Google Sheets in bulk

Every single website is the final result of hours of toil. Tracking every single domain can be an arduous task. However, being aware of the domain expiry date can help save users from losing the hours of work they have put into building the brand. This is why keeping track of the expiration date and periodically renewing the domain is important to maintain ownership. To monitor the domain expiry in Google Sheets in bulk, users can send automated requests or Google Scripts Code.

In this article, we will be taking a closer look at how you can monitor domain expiry in Google Sheets in bulk. In order to create a Google Spreadsheet, you will first have to visit the website of Google Docs. Then, you will have to sign up for a free Google account if you have not signed in already. 

If you are a systems administrator who has to manage a number of due dates, then using the best set of tools and features offered by Google Sheets will make it convenient to manage and organize and monitor domain expiries and other expiration reminders. Here’s how you can accomplish this task by using Google Apps Script Code for monitoring domain expiry in Google Sheets in bulk:

It is always critical and necessary to monitor the date of expiry of domains that you own. This is because you can avoid cancellation fees as well as save yourself from losing any important domains. 

The easiest way to check as well as remember the date of expiration of your domain is by using the Google Apps Script feature. You can use the Google Apps Script code to monitor the domain expiry in Google sheets in bulk. 

The domain expiration monitoring process basically refers to sending automated requests to a specific domain at a frequency pre-defined. And, then check the date of expiration. Monitoring a domain can serve as a precautionary approach to situations like phishing attacks, hijacking, and more. If you monitor the domain well, you can easily renew the address of your domain as well as maintain its ownership at the same time. 

In this article, we will tell you all about a custom script that you can use for monitoring all domain expiry dates. From helping you build a simple tracker to getting an email notification within a few days, as described in the script, you can use the below-mentioned Google Script code. You can also replace any parameters if needed for building it. 

It is always necessary and critical to monitor the expiry date of the domains you own so that you avoid cancellation fees and don’t lose your important domains.

If you own a lot of domains and you need a custom script to monitor all your domain expiry dates, you can build a simple tracker and get an email notification before some days as per your definition in the script.

Create a Google Apps script as below and replace the parameters as necessary to build this simple tool.

// Replace YOUR_SHEET_URL with the URL of your Google Sheet
var sheetUrl = 'YOUR_SHEET_URL';

// Replace YOUR_EMAIL_ADDRESS with the email address you want to send the notification to
var recipient = 'YOUR_EMAIL_ADDRESS';

function checkRenewalDates() {
  // Get the current date
  var today = new Date();
  Logger.log(today);

  // Get the sheet and the data range
  var sheet = SpreadsheetApp.openById(sheetUrl).getSheetByName('Sheet1');
  var dataRange = sheet.getDataRange();

  // Get the data from the sheet as an array
  var data = dataRange.getValues();

  // Iterate through the data and check the renewal dates
  for (var i = 0; i < data.length; i++) {
    var domain = data[i][0];
    var renewalDate = new Date(data[i][1]);
    Logger.log(renewalDate);
    // Calculate the number of days until the renewal date
    var daysUntilRenewal = Math.round((renewalDate - today) / (1000 * 60 * 60 * 24));

    // If the renewal date is within 7 days, send a notification email
    if (daysUntilRenewal <= 7) {
      sendNotificationEmail(recipient, domain, renewalDate);
    }
  }
}

function sendNotificationEmail(recipient, domain, renewalDate) {
  // Replace YOUR_EMAIL_ADDRESS with the email address you want the notification to be sent from
  var sender = 'YOUR_EMAIL_ADDRESS';
  var subject = 'Domain Renewal Reminder';
  var body = `The domain ${domain} will expire on ${renewalDate}. Please renew it before the expiration date to avoid any interruption of service.`;

  // Send the email
  MailApp.sendEmail(recipient, subject, body, {from: sender});
}