Turns mail carrying a Gmail label you choose into pages in a Notion database, and never files the same message twice.

UsesGmailNotion

File labelled email into a Notion database

Every hour, the mail in your Gmail account carrying a label you choose is collected and turned into pages in a Notion database, one page per message. The subject becomes the page title, and the page holds who sent it, when it was sent, a link that opens the original in Gmail, and the message body.

Once a page exists, the message picks up a second label, 'Filed to Notion', and the search that finds work deliberately leaves out anything carrying it, so a message is never filed twice however often the workflow runs. Everything goes into the page content rather than database columns, so it works with any database whatever its columns are called; the only column written is the title. A message that cannot be read or filed keeps its label, is reported in the run, and is tried again on the next sweep. Long messages are shortened to fit Notion's limit on a block of text.

You need a Gmail label to watch and a Notion database shared with your Notion integration.

ScheduleRun every hour.Run every hour.
ValuesSet gmailLabel to blank.Set gmailLabel to blank.
ValuesSet notionDatabaseId to blank.Set notionDatabaseId to blank.
ValuesSet filedLabel to Filed to Notion.Set filedLabel to Filed to Notion.
ValuesSet titleProperty to Name.Set titleProperty to Name.
ValuesSet maxEmails to 25.Set maxEmails to 25.
TextTrim gmailLabel and save it as watchLabel.Trim gmailLabel and save it as watchLabel.
TextTrim filedLabel and save it as doneLabel.Trim filedLabel and save it as doneLabel.
TextTrim notionDatabaseId and save it as databaseId.Trim notionDatabaseId and save it as databaseId.
TextTrim titleProperty and save it as titleColumn.Trim titleProperty and save it as titleColumn.
Decisions & LoopsIf a step below fails, save the error as labelExistsIf a step below fails, save the error as labelExists
Try
GmailGmailCreate label doneLabel.Create label doneLabel.
On error
ValuesShow in the output: Using the existing '@doneLabel' label in Gmail.Show in the output: Using the existing '@doneLabel' label in Gmail.
ValuesSet searchQuery to label:@watchLabel -label:@doneLabel.Set searchQuery to label:@watchLabel -label:@doneLabel.
GmailGmailList emails matching searchQuery. Save it as found.List emails matching searchQuery. Save it as found.
ValuesSet messages to found.emails.Set messages to found.emails.
ValuesSet filedCount to 0.Set filedCount to 0.
Decisions & LoopsFor each email in messages:For each email in messages:
Decisions & LoopsIf a step below fails, save the error as fileErrorIf a step below fails, save the error as fileError
Try
TextTrim email.id and save it as messageId.Trim email.id and save it as messageId.
TextShorten email.subject to 200 characters and save it as subject.Shorten email.subject to 200 characters and save it as subject.
TextTrim email.from and save it as sender.Trim email.from and save it as sender.
TextShorten email.body to 1800 characters and save it as bodyText.Shorten email.body to 1800 characters and save it as bodyText.
ValuesSet pageTitle to subject.Set pageTitle to subject.
Decisions & LoopsIf pageTitle is emptyIf pageTitle is empty
Yes
ValuesChange pageTitle to (no subject).Change pageTitle to (no subject).
No
No steps
Decisions & LoopsIf sender is emptyIf sender is empty
Yes
ValuesChange sender to (unknown sender).Change sender to (unknown sender).
No
No steps
Decisions & LoopsIf bodyText is emptyIf bodyText is empty
Yes
ValuesChange bodyText to (no message body).Change bodyText to (no message body).
No
No steps
ValuesSet messageLink to https://mail.google.com/mail/u/0/#all/@messageId.Set messageLink to https://mail.google.com/mail/u/0/#all/@messageId.
ValuesSet sentAt to (date not available).Set sentAt to (date not available).
Decisions & LoopsIf a step below fails, save the error as dateErrorIf a step below fails, save the error as dateError
Try
GmailGmailGet the sender, subject and date of email messageId. Save it as headers.Get the sender, subject and date of email messageId. Save it as headers.
TextTrim headers.Date and save it as dateHeader.Trim headers.Date and save it as dateHeader.
Decisions & LoopsIf dateHeader isn't emptyIf dateHeader isn't empty
Yes
ValuesChange sentAt to dateHeader.Change sentAt to dateHeader.
No
No steps
On error
ValuesShow in the output: Could not read the sent date for message messageId; filing it without one.Show in the output: Could not read the sent date for message messageId; filing it without one.
ValuesSet summary to From: senderSet summary to From: sender Sent: sentAt Gmail label: watchLabel.
NotionNotionCreate the page pageTitle in databaseId.Create the page pageTitle in databaseId.
Decisions & LoopsIf a step below fails, save the error as labelErrorIf a step below fails, save the error as labelError
Try
GmailGmailAdd label doneLabel to email messageId.Add label doneLabel to email messageId.
On error
ValuesShow in the output: Filed '@pageTitle' into Notion but could not add the '@doneLabel' label to the message, so it may be filed a second time on the next run.Show in the output: Filed '@pageTitle' into Notion but could not add the '@doneLabel' label to the message, so it may be filed a second time on the next run.
ValuesAdd 1 to filedCount.Add 1 to filedCount.
ValuesShow in the output: Filed '@pageTitle' from sender into Notion.Show in the output: Filed '@pageTitle' from sender into Notion.
On error
ValuesShow in the output: Could not file message email.id as text - it keeps its label and will be picked up on the next run. Reason: fileError as text.Show in the output: Could not file message email.id as text - it keeps its label and will be picked up on the next run. Reason: fileError as text.
ValuesShow in the output: filedCount as text message(s) filed into Notion from the '@watchLabel' Gmail label.Show in the output: filedCount as text message(s) filed into Notion from the '@watchLabel' Gmail label.