iT邦幫忙

2025 iThome 鐵人賽

DAY 11
0
DevOps

Mac 環境 n8n 30 天學習計畫系列 第 11

📝Day11:Notion CRUD 自動化練習

  • 分享至 

  • xImage
  •  

今天將只練習CRUD其中的Create, Read, Update!
Notion CRUD(Create / Read / Update / Delete)完整實作,而且你已經在 Notion Database 裡有以下欄位:

  • Title(標題)
  • Select(下拉選單)
  • Date(日期)
  • Number(數字)
  • Checkbox(勾選)
  • Rich Text(文字說明)
    https://ithelp.ithome.com.tw/upload/images/20250923/2016914491uF8Xf1PO.png

0️⃣ 事前準備(昨日已創建過)

  1. 確認有一個 Notion Database(表格型)。
  2. Integration(n8n Notion 連線)已經被邀請到該 Database(權限至少 Editor)。
  3. 記下 Database ID(網址中的 32 位字串)。
    https://ithelp.ithome.com.tw/upload/images/20250923/2016914482y3AGPI2C.png

1️⃣ Create(新增資料)

https://ithelp.ithome.com.tw/upload/images/20250923/20169144jDuJtNpt6W.png

  1. 在 n8n 新增 Notion Node

  2. Resource 選擇 Page

  3. Operation 選擇 Create

  4. Database ID:填入你的 Database ID。

  5. 在 Properties 中填入各欄位:

    • Title → "day11資料輸入測試create"
    • Select → "完成"
    • Date → 2025-09-25
    • Number → 9375205793
    • Checkbox → true
    • Rich Text → "day11 create"

https://ithelp.ithome.com.tw/upload/images/20250923/20169144YGqMIm0cAm.png

https://ithelp.ithome.com.tw/upload/images/20250923/20169144TjujU7Kxg0.png

https://ithelp.ithome.com.tw/upload/images/20250923/20169144pzhh3VR5ax.png
👉 執行後,會在 Notion Database 新增一列。
https://ithelp.ithome.com.tw/upload/images/20250923/20169144Vm2RtIzmrh.png

2️⃣ Read(讀取資料)

https://ithelp.ithome.com.tw/upload/images/20250923/201691447w9hmIjsGL.png

  1. 新增 Notion Node
  2. Resource 選擇 Database
  3. Operation 選擇 Get Many
  4. Database ID:同樣填入你的 Database ID。
  5. 執行後,你會看到 Notion Database 裡的所有項目(JSON 格式)。
    https://ithelp.ithome.com.tw/upload/images/20250923/20169144tKAQcjnlxA.png
    👉 這讓你確認資料有沒有正確寫入。
    https://ithelp.ithome.com.tw/upload/images/20250923/201691442VAhuhUAnf.png

3️⃣ Update(修改資料)

https://ithelp.ithome.com.tw/upload/images/20250923/20169144GaydAT0yav.png

  1. 先用 Get Many 抓資料,從 JSON 裡取得某個 Page 的 Page ID

  2. 新增 Notion Node

  3. Resource 選擇 Page

  4. Operation 選擇 Update

  5. Page ID:貼上剛剛要修改的那個 ID。

  6. 修改某些欄位:

    • Date → 2025-10-01
    • Number → 998877665544332200
    • Rich Text → "day11-test(update)"

https://ithelp.ithome.com.tw/upload/images/20250923/20169144eew6EShiXr.png
👉 執行後,Notion 該列會被更新。
https://ithelp.ithome.com.tw/upload/images/20250923/20169144E9Db8buUNy.png

🚦 總結(CRUD 四步)

  • Create → 在 Notion 建立一列資料。
  • Read → 把資料抓回來(可以搭配條件篩選)。
  • Update → 修改某筆資料的欄位值。
  • Delete → 將資料封存(API 叫做 Delete)。

上一篇
Day10:n8n + Notion 新增資料庫項目
下一篇
Day12:If 判斷 → 分流處理 Email📧
系列文
Mac 環境 n8n 30 天學習計畫12
圖片
  熱門推薦
圖片
{{ item.channelVendor }} | {{ item.webinarstarted }} |
{{ formatDate(item.duration) }}
直播中

尚未有邦友留言

立即登入留言