Skip to content

Instantly share code, notes, and snippets.

@sbauch
Last active September 27, 2022 00:59
Show Gist options
  • Save sbauch/b9df98672c828dfe24c595e1c74c1bf2 to your computer and use it in GitHub Desktop.
Save sbauch/b9df98672c828dfe24c595e1c74c1bf2 to your computer and use it in GitHub Desktop.
ENS names in Google Sheets
// Easily resolve addresses in a Google sheet to ENS names via @frolic's ENS resolution API - https://ensideas.com/about
// 1. In a Google sheet, select the menu item Extensions > Apps Script.
// 2. Replace the example code in the editor with the below function:
function LOOKUP_ENS(input) {
var endpoint = "https://api.ensideas.com/ens/resolve/" + input;
var response = UrlFetchApp.fetch(endpoint);
var json = response.getContentText();
var data = JSON.parse(json);
return data.displayName;
}
// 3. Click the disk icon to save
// 4. click "Run" to check permissions
/* 5. Return to the sheet you want to use the formula. In a field, add the formula
=LOOKUP_ENS(address)
You probably want to reference another field that contains an address, like
=LOOKUP_ENS(A1)
The cell will display an ENS name if one is configured for the address, otherwise the truncated address is displayed.
*/
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment