Last active
January 5, 2018 16:45
-
-
Save pedromenezes/89e35ab567af01a37b6ef18a2e01bedf 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 dolarHojePegaCotacao(url, reference){ | |
return parseFloat(UrlFetchApp.fetch(url.replace(/([^\/]+)$/, '$1/') + "cotacao.txt").getContentText().replace(',', '.')); | |
} | |
function refresh() { | |
SpreadsheetApp.getActiveSheet().getActiveCell().setValue("Última atualização: " + new Date().toLocaleString()); | |
} | |
function onOpen(e) { | |
SpreadsheetApp.getUi().createMenu('Dólar Hoje').addItem('Atualizar', 'refresh').addToUi(); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Só mais uma idéia, para quem preferir pegar a cotação da Foxbit pode usar esse código aqui na funçao de pegar cotação.
Valeu, seu script me ajudou bastante! Abraço