Skip to content

Instantly share code, notes, and snippets.

View daltux's full-sized avatar
💻
Busy. I may be slow to respond.

Daltux daltux

💻
Busy. I may be slow to respond.
View GitHub Profile
@daltux
daltux / TESOURODIRETO(taxa).js
Created November 23, 2023 21:23 — forked from lucashmsilva/TESOURODIRETO(taxa).js
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) {