Last active
January 6, 2022 10:45
-
-
Save svzdvd/88d838a74d115463a607fc2ea1446bda to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// names / ids: https://docs.google.com/spreadsheets/d/1wTTuxXt8n9q7C4NDXqQpI3wpKu1_5bGVmP9Xz0XGSyU/edit#gid=0 | |
function ccprice(name, currencyOpt) { | |
var currency = currencyOpt || "usd"; | |
var url = 'https://api.coingecko.com/api/v3/simple/price?ids=' + name + '&vs_currencies=' + currency.toLowerCase(); | |
var response = UrlFetchApp.fetch(url); | |
var json = response.getContentText(); | |
var jsonobject = JSON.parse(json); | |
var datatoreturn = jsonobject[name][currency.toLowerCase()] | |
return datatoreturn; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment