Notion is an amazing tool to organise all kind of information. But it can be tough to get that data into Notion in the first place. Sure, you could go ahead and manually enter it or copy it over from another tool. But what if you could build a simple automation instead that handled this for you? Whether it’s an email attachment, an invoice, a screenshot, or even an old-school letter, this approach works for all of them. Best of all? It’s completely free and doesn’t require any complicated steps. Let’s dive in!
Process Overview
The idea behind this workflow is super simple.
In order to add pretty much any kind of information to Notion, you’ll set up the following elements:
- A rule in your email system to automatically label emails that contain relevant information
- An automation that will take the attachment from the email and use AI to extract all relevant information
- A Notion database to store the extracted information
You could use pretty much any major automation tool for this workflow, like Zapier or Make. In this tutorial, we’ll be using Relay.app.
Relay.app is perfect for this use case because of their easy UI, the deep integration with AI tools and their very generous free plan. All things combined means that you can build this automation in just a few minutes for free, even if you never automated anything before.
First, let’s look at how we can use this workflow to extract data from invoices and add it to Notion.
How To Get Invoices Into Notion
Step 1: How To Set Up Notion Database To Get Data Into Notion
The first step is to create a Notion database (let’s call it Invoices) to store your invoice data. Add a new database with the following properties:
- Name (Default property)
- Amount Paid (Number property): Invoice amount
- Date (Date property): Date of the invoice
You can customise the properties as needed depending on what information you want to extract.
Step 2: How To Setup Your Gmail Account To Get Data Into Notion
Now, let’s configure your Gmail account.
You need an easy way to tell Relay.app which emails to process. Luckily, you don’t have to do this manually thanks to the fairly robust rules in Gmail
If you don’t use Gmail as your main email tool, you have two options. Either set up the equivalent in your tool or create a free gmail account just for the purpose of this automation. Then, you can simply forward relevant emails to that address.
First, create a new label in your Gmail account. Click the plus icon next to Labels in the sidebar and name it Extract Data.
To set up the filter, click the Show view options icon beside the search bar, type Extract Invoice in the Subject field, and click Create filter. Then, choose Apply the label > Extract Data and click Create filter.
Now, every time you send an email with the subject Extract Invoice, it will be stored under the Extract Data label.
Next, email a picture of an invoice to this Gmail account with the subject line “Extract Invoice” (or any subject you prefer). This step is crucial for testing the automation later.
Double-check that the automation correctly applies the label.
With this initial prep out of the way, it’s time to set up your automation in Relay.app!
Step 3: How To Setup Relay.App To Get Data Into Notion
In this step, you’ll set up Relay.app to fetch images from emails, extract data using AI, and send that data to Notion.
First, create a free account on Relay.app. The generous free tier should be sufficient for this scenario. Once you’ve signed up, it’s time to create your first workflow.
Click on New Workflow in the top-right area to create a new workflow.
Name it Extract Invoice (or anything you prefer).
The first task is to fetch emails from your Gmail account. Click on + Add trigger to create a new trigger and select Gmail > Label Added.
If you haven’t already connected your Gmail account, you’ll need to do so now. It’s pretty straight forward and you just have to follow the authentication process. This is the Gmail account where you will send the bills and invoicce to extract data.
Currently, Relay.app only lets you authorise a Gmail account that matches the email that you signed up with. If you need to use a different Gmail account for this purpose, you can work around this limitation by creating a new user in your workspace with the different email.
After connecting your Gmail account, you will see a new dialogue box where you can configure the integration.
Configure the workflow by selecting the label you created earlier: Extract Data. Add any additional filters if needed, but for this setup, you don’t need any. Click on Done to complete the Gmail setup.
Next, set up the AI to extract essential data. Relay allows you to use your own OpenAI account, but for general purposes, its native GPT-4-powered AI is sufficient.
Click on Add Step and select AI > Custom Prompt. You can choose other options based on your needs, but for this guide, you’ll write a custom prompt.
Use the following prompt for extracting invoice data:
You are an expert personal assistant who extracts relevant data from invoice images. Please extract the total amount paid and the topic of the invoice of the attached image!
If you need to extract other information like the date, you can adapt the prompt accordingly.
To get the Gmail attachment as an input, click Additional context and select Email > Attachment.
Now, you need to define the output of the prompt. Under the Output section, click on Add field. Set the Property Name and Field Type based on your requirements. Click on Save to create the new field.
For this scenario, create the following fields:
- Topic (Field Type: Text)
- Total Amount Paid (Field Type: Number)
It’s time to test the setup to ensure it works correctly.
Under Test this step, select Email > Extract Email and click on Test. If everything is set up properly, you should see the output in the Topic and Total Amount Paid fields.
If you’re satisfied with the results, click on Done and proceed to map the AI output to Notion database properties.
Click on the plus icon to add a new step. This time, select Notion > Add page to database.
Just like the Gmail integration, you need to connect your Notion workspace to Relay by clicking on Connect and following the prompts.
A new page will open where you need to select the database where you want to get the data. Click on Select pages and choose the Invoices database (or the parent page if you want multiple databases). Click on Allow access to complete the connection.
Double-check in Notion that the connection with Relay is established. Click on the three-dot menu icon and under Connections, you should see Relay App. If not, click on Connect to and search for Relay App.
Back in Relay, you should see a window titled Add page to database. Select your Invoices database (or the one you’ve created for this purpose).
Now, you need to map the responses to the correct database properties. Under Fields to populate, click on Add field and select Name. For the output, click the plus icon on the right and choose Model Response > Topic.
Add another field and select Amount Paid. This time you’ll select Model Response > Total Amount Paid.
Now for the date field, go to Reference Date, and choose Workflow Run > Start Date. This will populate the date on which the automation runs. You can customise it as needed.
Click on Done to complete this step. Now, test the entire workflow. Click on Start a test run.
It will prompt you to select a mail for testing purposes. Select an email with the invoice attachment and subject line Extract. Click on Create test run. This will set up an environment to test the workflow. Click Start Run and let it run in the background.
Once you see Run is completed, check your Notion database. You should see the Topic name, amount, and date populated.
That’s it! Your workflow is complete. Next time you want to automatically store your invoice data in Notion, just take a picture of the invoice and email it as an attachment to your dedicated Gmail address. The data will appear in your Notion database in no time.
Let’s look at another example now — sending sleep data from your health app to Notion.
How To Get Sleep Data From Health App To Notion
What if you have an Ultrahuman smart ring that tracks your sleep data and you want to keep all that information organised in your Notion workspace?
(maybe even create some charts in Notion?)
It’s pretty simple now that you have everything set up with Notion, Gmail, and Relay.app. Just a few simple adjustments and you’ll be good to go.
Similar to the previous setup, you’ll need a Notion database for this. If you already have a habit tracker in Notion, then you can simply adapt the database with the corresponding properties.
If you want a dedicated database, you could Sleep Tracker with the following properties:
- Name (Default Text property)
- Sleep Score (Number property)
- Awake (Number property)
- REM Sleep (Number property)
- Light Sleep (Number property)
- Deep Sleep (Number property)
Next, go back to Gmail. Here, you have two options:
- Create a new label with a new subject line (e.g., Sleep Tracker).
- Use the same label but add an additional filter in the Relay app.
For simplicity, let’s go with the first approach. Create a new label and set the filter rule to where the subject is Extract Sleep Data. This way, you can have separate labels for different purposes.
Then, take a screenshot of your sleep data (from the Ultrahuman app or any other health-tracking app) and email that screenshot to your dedicated email with the subject Extract Sleep Data.
Just like before, double-check that the email is labelled correctly before proceeding to the next step.
Head over to the Relay app and duplicate the workflow you created earlier (Extract Invoice Data). Rename it to Extract Sleep Data.
Since everything is already set up, you can get this up and running pretty quickly. Go to the Gmail step and select the label Extract Sleep Data.
For the Prompt GPT-4 setting, you need to change the prompt. You can use something along the following lines:
You are an expert personal assistant who extracts sleep data from an app screenshot. Take a look at the attached screenshot and extract:
- Sleep Score
- Awake (time in min)
- REM Sleep (time in min)
- Light Sleep (time in min)
- Deep Sleep (time in min)
Since the prompt is different, the outputs also need to be updated. Discard the previous outputs and set the following for this prompt:
- Sleep Score (Field Type: Number)
- Awake (Field Type: Number)
- REM Sleep (Field Type: Number)
- Light Sleep (Field Type: Number)
- Deep Sleep (Field Type: Number)
To test this, under Test this step, select the email “Extract Sleep Data” and click on Test. In a moment, you should see the AI responses. Check if everything is correct!
It’s quite amazing how the AI converts hours into minutes for us and makes it easier to store data in Notion without any hassle.
Pro Tip: To avoid any issue regarding sleep data extraction, try to use screenshots or images with a similar layout (i.e., using the same section within the same app)
The last step is mapping the new responses to the appropriate database properties. To do this, go to the Add page to step and select Sleep Tracker as the target database. If you don’t see it, ensure you’ve created the database in the same Notion page you previously gave access to, or you have to connect the newly created page or database to Relay.
After selecting the Sleep Tracker database, you need to map the responses. Under Fields to populate, add the following fields (similar to what you did before):
- Name: Workflow run > Current date/time
- Sleep Score: Model Responses > Sleep Score
- Awake: Model Responses > Awake
- REM Sleep: Model Responses > REM Sleep
- Light Sleep: Model Responses > Light Sleep
- Deep Sleep: Model Responses > Deep Sleep
Click on Authorize, then Done to complete the setup. Now, test the entire workflow. Click Start a test run and select Extract Sleep Data as the subject. Now click on Create test run and then Start run.
If everything is set up correctly, all the sleep data should appear in their designated fields in the Notion database. It might take a minute or so but it’ll be there for sure!
There you go! Here is the powerful workflow to get any data into Notion. You can of course build any workflow and extract any data you want. The only limit is your imagination.