To split the main title of a database entry in Notion and automatically populate “First Name” and “Surname,” you can use either Notion’s formula properties or an integration with the Notion API for more advanced automation. Here’s how you can achieve this:
If you’re working entirely within Notion, you can use formulas in database properties to split the title.
- Identify the Main Title: Assume the main title of the entry is in a column named
Name.
- Create New Properties:
- Add a new property named First Name (type: Formula).
- Add another property named Surname (type: Formula).
- Set Formulas:
- For First Name:
if(find(" ", prop("Name")) > 0, slice(prop("Name"), 0, find(" ", prop("Name"))), prop("Name"))
This formula extracts everything before the first space. If there’s no space (single name), it returns the full name.
- For Surname:
if(find(" ", prop("Name")) > 0, slice(prop("Name"), find(" ", prop("Name")) + 1), "")
This formula extracts everything after the first space. If there’s no space, it leaves the field empty.
For automated workflows, you can use the Notion API to process the title and populate the “First Name” and “Surname” properties.
- Basic programming knowledge (Python, JavaScript, etc.).
- API access to your Notion workspace.
- A script or service to split and update the data.
Here’s an example script using Python to split the Name property and update the database.
# Replace with your Notion API key and database ID
NOTION_API_KEY = "your_notion_api_key"
DATABASE_ID = "your_database_id"
"Authorization": f"Bearer {NOTION_API_KEY}",
"Content-Type": "application/json",
"Notion-Version": "2022-06-28"
def get_database_entries():
url = f"https://api.notion.com/v1/databases/{DATABASE_ID}/query"
response = requests.post(url, headers=HEADERS)
def update_entry(entry_id, first_name, surname):
url = f"https://api.notion.com/v1/pages/{entry_id}"
"rich_text": [{"text": {"content": first_name}}]
"rich_text": [{"text": {"content": surname}}]
requests.patch(url, headers=HEADERS, json=data)
def split_name_and_update():
entries = get_database_entries()
for entry in entries["results"]:
name = entry["properties"]["Name"]["title"][0]["plain_text"]
parts = name.split(" ", 1)
surname = parts[1] if len(parts) > 1 else ""
update_entry(entry_id, first_name, surname)
- The script fetches entries from the database.
- It splits the
Name field into First Name and Surname.
- It updates the database with the split values.
If you don’t want to code, you can use tools like Zapier or Make to automate this:
- Set up a trigger for new/updated entries in your Notion database.
- Use a text-splitting function (Zapier Formatter or Make tools).
- Update the Notion database with the split values.
Would you like detailed help setting up one of these approaches?