Notion Exporter
Overview
Extract and transform Notion content at scale—databases, pages, and nested wikis—into portable formats for archival, CMS migration, documentation publishing, and data pipelines.
When to Use
- •Exporting a Notion wiki to a static docs site (Markdown/MDX)
- •Migrating Notion databases to Airtable, Supabase, or CSV
- •Creating scheduled backups of Notion workspaces
- •Converting Notion specs into formatted PDFs for clients
- •Syncing Notion content to a CMS like Contentful or Ghost
Instructions
- •Accept inputs: Notion integration token, source (database ID or page ID), export format (markdown/csv/json/pdf), include_subpages flag, schedule (optional).
- •Authenticate with the Notion API using the integration token.
- •Traverse the source recursively if include_subpages=true; collect all child pages and database entries.
- •For databases: resolve relations, rollups, and formulas into human-readable values.
- •Transform content blocks to the target format (rich text, images, code, callouts, tables).
- •Write output files with proper naming convention based on page titles and timestamps.
- •If scheduled, register export as a recurring job.
- •Return export summary: pages exported, file paths, total size, duration.
Environment
code
NOTION_TOKEN=secret_your_notion_integration_token NOTION_SOURCE_ID=your_database_or_page_id EXPORT_FORMAT=markdown OUTPUT_DIR=./notion_exports INCLUDE_SUBPAGES=true
Examples
Input:
code
source: notion_database_id_abc123 format: csv resolve_relations: true output: ./exports/crm_contacts.csv
Output:
code
Export complete. Pages exported: 1 database Rows: 3,847 records Relations resolved: supplier_id, buyer_id File: ./exports/crm_contacts.csv (1.2 MB) Duration: 18s