4️⃣

S20. Google Form 連携アプリ

ここからはアプリ作成の手順を解説

20.1 Google Form の作成

20.2 Notion データベース作成

20.3 GAS の記述

  • スクリプトは以下のようになります。
    • # スプレッドシートの最終行のデータを取得 function getLine() { const sheet = getSheet() const line = sheet.getLastRow() return sheet.getRange("B" + line + ":G" + line).getValues()[0] } # Payload を作成 function createPayload(values) { const tags = values[4].split(", ").map(s => ({["name"]: s})) return { "parent": { "database_id": databaseID(), }, "properties": { "Request": { "title": [ { "type": "text", "text": { "content": values[1] } } ] }, "Keyword": { "rich_text": [ { "type": "text", "text": { "content": values[2], "link": { "url": values[0] } } } ] }, "Contributor": { "rich_text": [ { "type": "text", "text": { "content": values[5] } } ] }, "Link": { "url": values[0] }, "Kind": { "select": { "name": values[3], } }, "Tags": { "multi_select": tags } } } } # Form データを Notion に送付 function updateForm() { createPage(createPayload(getLine())) }
      作成したスクリプト
この後の作業は書籍を参照してください。