Check Domain’s expiry date in Google Sheets using Google Apps Script and a WHOIS API

Yes, you can check a domain’s expiry date in Google Sheets using a combination of Google Apps Script and a WHOIS API. Here’s how you can do it:

Step 1: Get a WHOIS API Key

  1. Sign up for a WHOIS API service. Some popular options include:
  2. Once you have signed up, get your API key from the service.

Step 2: Set Up Google Apps Script

  1. Open your Google Sheets document.
  2. Go to Extensions > Apps Script.
  3. Delete any code in the script editor and paste the following code. Replace YOUR_API_KEY with your actual WHOIS API key:
function getDomainExpiry(domain) {
  var apiKey = 'YOUR_API_KEY';
  var url = 'https://www.whoisxmlapi.com/whoisserver/WhoisService?apiKey=' + apiKey + '&domainName=' + domain + '&outputFormat=JSON';
  var response = UrlFetchApp.fetch(url);
  var data = JSON.parse(response.getContentText());
  
  if (data.records && data.records.length > 0 && data.records[0].expiresDateISO8601) {
    return data.records[0].expiresDateISO8601;
  } else {
    return 'Expiry date not found';
  }
}

function DOMAIN_EXPIRY(domain) {
  return getDomainExpiry(domain);
}
  1. Save the script with a name like DomainExpiry.

Step 3: Use the Function in Google Sheets

  1. In a cell where you want to display the domain expiry date, use the custom function like this:
=DOMAIN_EXPIRY("example.com")

Replace example.com with the actual domain you want to check.

Explanation

  • The getDomainExpiry function fetches the domain expiry date using the WHOIS API.
  • The DOMAIN_EXPIRY function is a custom function that can be used directly in Google Sheets.

Notes

  • Be mindful of the rate limits and usage quotas of the WHOIS API service you choose.
  • Some WHOIS API services might require different URL formats or additional parameters, so adjust the script accordingly.

This setup will allow you to check domain expiry dates directly within your Google Sheets.

0 0 votes
Article Rating
Subscribe
Notify of
guest

0 Comments
Oldest
Newest Most Voted
Inline Feedbacks
View all comments
0
Would love your thoughts, please comment.x
()
x