NotionExporter is a Windows command-line tool built with .NET that exports data from the Notion API into JSON format. It supports exporting databases, pages, blocks, and allows for custom filters and sorting via query files.
- β Export Notion databases, pages, and blocks
- β Output to JSON file or standard output
- β Support for Notion filters and sorts
- β Accepts Notion API token from CLI, environment variables, config file, or secure prompt
- β
Clean and modular CLI built with
Spectre.Console.Cli
Download the latest release from the Releases page.
- β Self-contained executable for Windows
- β No .NET installation required
- .NET 9 SDK (preview) or newer
- Windows 10 or higher
- Build the application:
dotnet publish -c Release- Run it:
NotionExporter.cli.exe [command] [options]NotionExporter.cli.exe databases export --id 1234abcd --output data.jsonNotionExporter.cli.exe databases export --id 1234abcdNotionExporter.cli.exe databases export --id 1234abcd --filter-file query.jsonExample query.json:
{
"filter": {
"property": "Date",
"date": {
"this_week": {}
}
},
"sorts": [
{
"property": "Name",
"direction": "ascending"
}
]
}- Create a Notion integration
- Obtain your Internal Integration Token
- Use the token in one of the following ways:
- As CLI argument:
--token <your-token> - As environment variable:
NOTION_API_TOKEN - Or enter it securely via prompt if not provided
- As CLI argument:
NotionExporter.cli.exe databases export --id 1234abcd |
ConvertFrom-Json |
% { $_.results } |
% { [PSCustomObject]@{ Name = $_.properties.Name.title[0].plain_text } } |
Format-Table -AutoSizeYou can provide configuration via:
appsettings.json- Environment variables
Pull requests are welcome!
Feel free to open issues for bugs, suggestions, or feedback.
This project is licensed under the MIT License. See LICENSE for details.