I use a Google Docs spreadsheet to manage all my domains. It contains a list of all the domain names I own, along with their expiry dates, the name of the registrar the domain is registered with, and some other details. I also wanted to also add a column showing the nameservers, so I could tell which domains were parked vs which domains I'm actively using.

Google Apps Script provides a URLFetchApp.fetch function to perform network requests. We can combine this with Google's DNS-over-HTTPS API to load DNS records for a given domain:

function GetDNSEntries(domain, type) {
  var response = UrlFetchApp.fetch('https://dns.google.com/resolve?name=' + domain + '&type=' + type);
  var data = JSON.parse(response);
  var results = data.Answer.map(function(answer) {
    // Remove trailing dot from answer
    return answer.data.replace(/\.$/, '');
  return results.sort().join(', ');

We can then use this function in a spreadsheet:

=GetDNSEntries(A1, "NS")

This results in a column listing the DNS servers for each domain, with data that's always kept up-to-date by Google Docs:

Short URL for sharing: https://d.sb/B5Q. This entry was posted on 26th August 2017 and is filed under Web Development. You can leave a comment if you'd like to, or subscribe to the RSS feed to keep up-to-date with all my latest blog posts!


  1. Avatar for Maksym Popenko Maksym Popenko said:

    It's awesome! Thanks for sharing.

  2. Avatar for Gautam Gautam said:

    hey Daniel, thanks for the awesome work. Is it possible to get a copy of the spreadsheet .. ofcourse without the list of domain names .. Just the scripts. Much appreciated. thanks