function fetchApiData() {
const apiUrl = "https://api.example.com/data";
const response = UrlFetchApp.fetch(apiUrl);
const data = JSON.parse(response.getContentText());

// Write data to your sheet
const sheet = SpreadsheetApp.getActiveSheet();
sheet.getRange(1, 1).setValue(data.result);
}