python-iot

第4回

GASのコードサンプル

function doPost(e) {
  let data = JSON.parse(e.postData.getDataAsString());

  let book = SpreadsheetApp.openById('スプレッドシートのID');
  let sheet = book.getSheetByName("シート1");
  let now = new Date();
  sheet.appendRow([now,data.temperature,data.humidity]);
  return ContentService.createTextOutput(JSON.stringify(e));
}