Updated.
function fetchBitcoinPriceCoinDesk() { var sheet = SpreadsheetApp.getActiveSpreadsheet().getSheetByName("Sheet1"); // Change "Sheet1" to your actual sheet name var url = "https://api.coindesk.com/v1/bpi/currentprice/USD.json"; // CoinDesk API URL for Bitcoin price in USD try { // Fetch the API data var response = UrlFetchApp.fetch(url); var jsonData = JSON.parse(response.getContentText()); // Get the rate_float (Bitcoin price in USD) from the API response var price = jsonData.bpi.USD.rate_float; // Set the price in the target cell (e.g., B3) sheet.getRange("B3").setValue(price); } catch (error) { Logger.log("Error fetching price: " + error); sheet.getRange("B3").setValue("Error fetching price"); } }