9 lines
323 B
JavaScript

function callApiExample() {
const url = "https://jsonplaceholder.typicode.com/todos/1";
const response = UrlFetchApp.fetch(url);
const data = JSON.parse(response.getContentText());
const sheet = SpreadsheetApp.getActiveSheet();
sheet.getRange(1, 1).setValue(data.title); // A1 に API のタイトルを書く
}