Notion Database Automation
by @potatosolo
Automate common Notion database operations like batch page creation, data filtering, content generation, and export. Use when you need to automate workflows...
clawhub install notion-db-automationπ About This Skill
name: notion-db-automation description: Automate common Notion database operations like batch page creation, data filtering, content generation, and export. Use when you need to automate workflows with Notion databases, bulk process entries, or sync data between Notion and other tools.
Notion Database Automation
Automate repetitive tasks with Notion databases. Save hours of manual work by scripting common database operations.
Core Capabilities
1. Query and filter database entries
2. Batch create pages
3. Batch update entries
4. Export database
5. Create database from template
Supported Property Types
Quick Start
Prerequisites
1. Create a Notion integration at https://www.notion.so/my-integrations 2. Get your API token 3. Share your database with the integrationExample: Query a database
from scripts.notion_client import NotionDBClientclient = NotionDBClient(api_token="YOUR_TOKEN")
entries = client.query_database(
database_id="YOUR_DB_ID",
filter={
"property": "Status",
"select": {
"equals": "To Do"
}
},
sorts=[{"property": "Created", "direction": "descending"}]
)
for entry in entries:
print(entry["properties"]["Name"]["title"])
Example: Create multiple pages from CSV
from scripts.batch_create import create_from_csvcreate_from_csv(
api_token="YOUR_TOKEN",
database_id="YOUR_DB_ID",
csv_file="data.csv"
)
Common Workflows
Content Calendar Automation
1. Import a list of article topics from a spreadsheet 2. Auto-create calendar entries in Notion with scheduled publish dates 3. Add status = "Scheduled" automaticallyTask Management Automation
1. Filter tasks due today 2. Send summary to your email/chat 3. Mark old tasks as archived automaticallyCRM Lead Processing
1. When new leads come in, create Notion entries automatically 2. Assign properties based on source 3. Add AI-generated summary of the leadScripts
scripts/notion_client.py
Wrapper around the Notion API with simplified interface for common operations.scripts/batch_create.py
Batch create database entries from CSV or JSON.scripts/batch_update.py
Batch update entries matching filter conditions.scripts/export_csv.py
Export entire Notion database to CSV file.templates/
Pre-built database schemas for common use cases:
content_calendar.json - Content calendar for bloggers/marketerstask_tracker.json - Simple task trackercrm_basic.json - Basic CRM for small businessAuthentication
The skill expects your Notion API token to be provided. You can:
NOTION_API_TOKENWhen to use this skill
β Use when:
β Don't use when:
π‘ Examples
Prerequisites
1. Create a Notion integration at https://www.notion.so/my-integrations 2. Get your API token 3. Share your database with the integrationExample: Query a database
from scripts.notion_client import NotionDBClientclient = NotionDBClient(api_token="YOUR_TOKEN")
entries = client.query_database(
database_id="YOUR_DB_ID",
filter={
"property": "Status",
"select": {
"equals": "To Do"
}
},
sorts=[{"property": "Created", "direction": "descending"}]
)
for entry in entries:
print(entry["properties"]["Name"]["title"])
Example: Create multiple pages from CSV
from scripts.batch_create import create_from_csvcreate_from_csv(
api_token="YOUR_TOKEN",
database_id="YOUR_DB_ID",
csv_file="data.csv"
)
βοΈ Configuration
1. Create a Notion integration at https://www.notion.so/my-integrations 2. Get your API token 3. Share your database with the integration
Example: Query a database
from scripts.notion_client import NotionDBClientclient = NotionDBClient(api_token="YOUR_TOKEN")
entries = client.query_database(
database_id="YOUR_DB_ID",
filter={
"property": "Status",
"select": {
"equals": "To Do"
}
},
sorts=[{"property": "Created", "direction": "descending"}]
)
for entry in entries:
print(entry["properties"]["Name"]["title"])
Example: Create multiple pages from CSV
from scripts.batch_create import create_from_csvcreate_from_csv(
api_token="YOUR_TOKEN",
database_id="YOUR_DB_ID",
csv_file="data.csv"
)