Skip to content

Instantly share code, notes, and snippets.

View Tiagoalvesds's full-sized avatar

TIAGO ALVES DOS SANTOS Tiagoalvesds

View GitHub Profile
@lucashmsilva
lucashmsilva / TESOURODIRETO(taxa).js
Last active January 11, 2024 13:26
API para criar a função TESOURODIRETO Google Sheets
/*
* @return Retorna a cotação atual de um título específico do Tesouro Direto Junto com a taxa anual de retorno
* @customfunction
**/
function TESOURODIRETO(bondName) {
let srcURL = "https://www.tesourodireto.com.br/json/br/com/b3/tesourodireto/service/api/treasurybondsinfo.json";
let jsonData = UrlFetchApp.fetch(srcURL);
let parsedData = JSON.parse(jsonData.getContentText()).response;
for(let bond of parsedData.TrsrBdTradgList) {