Last active
October 1, 2018 15:03
-
-
Save kaskad88/c51f5c442e74b5ba61f7c1173038bf10 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
function kursnbu( date ) { | |
if ( ! date ) { | |
return 0; | |
} | |
var apiUrl = 'https://bank.gov.ua/NBUStatService/v1/statdirectory/exchange?valcode=USD&date=', | |
dateApiFormat = Utilities.formatDate(date, "GMT+3", "yyyyMMdd"), | |
url = apiUrl + dateApiFormat + '&json', | |
response = UrlFetchApp.fetch( url ), | |
json = response.getContentText(), | |
data = JSON.parse(json); | |
return data[0].rate; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment