Delete blocks from page
Tags: #notion #productivity #naas_drivers #operations #snippet #page
Description: This notebook allows users to quickly and easily delete blocks from their Notion page.
from naas_drivers import notion
- Share integration with your database / page
# Enter Token API
NOTION_TOKEN = "ENTER_YOUR_NOTION_TOKEN_HERE" # EXAMPLE: "secret_xxxxxxxxxxxxxxxxxx"
# Enter Page URL
PAGE_URL = "ENTER_YOUR_PAGE_URL_HERE" # EXAMPLE: "https://www.notion.so/xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
page = notion.connect(NOTION_TOKEN).page.get(PAGE_URL)
blocks = page.get_blocks()
if len(blocks) > 0:
while True:
for block in blocks:
notion.connect(NOTION_TOKEN).blocks.delete(block.id)
blocks = page.get_blocks()
if len(blocks) == 0:
break
page.update()
Last modified 1mo ago