Introduction

In this example we will show you a very basic workflow on how you can extract invoice data with the Eagle Doc Finance API within a n8n workflow. The workflow gets triggered whenever a new document is uploaded to a folder in google drive. Then it extracts information and stores them in a google sheet. This workflow shows the basic usage and provides a starting point for further extension. You can extend this workflow for example to fetch automatically invoices from your email account, store the invoices in a specific folder after processing or upload them into your document management system.

Prerequisites

For this introduction we take the following assumptions:

  1. Running n8n instance available. If you do not have a n8n instance running yet you can for example follow this video tutorial to set it up (YouTube Video).
  2. Google account available.
  3. Eagle Doc API key. If you do not have an Eagle Doc API key yet, you can obtain it in the Dashboard.
  4. Added your credentials of your google account to n8n. If you do not have done this yet, you can follow this tutorial (YouTube Video).

Eagle Doc API Key in Dashboard

Create the Workflow

We will create the following basic workflow to extract information from newly added invoices and store the information in a google sheet.

Eagle Doc n8n workflow overview

Google Drive Trigger

Let us start with the "Google Drive Trigger", the first node on the left. This node shall start triggering the workflow as soon as there is a new file added to a dedicated folder in google drive. You will find this node when searching for "Google Drive" in n8n.

First create a new folder in google drive which will later store the invoices. After you have created the folder, copy the url from your browser.

Creating a new folder in Google Drive

The url will now be used for the node configuration. Copy the url in the Folder section like shown below. If there is another folder option selected like "From list" or "By ID" change it to "By URL". Now you can also change the interval how often n8n shall check the folder for changes. In this example we have set it to "Every Minute". Check also that the other settings like "Trigger On" and "Watch For" are set correctly.

Configuring Google Drive Trigger in n8n

Download File

The "Download File" node can be found as well when searching for "Google Drive". The important setting is in section "File". Here we have to set "By ID" and use {{ $json.id }}. You can either type it manually or just drag and drop the field from the left side. In order to do this you have run the previous node first.

Configuring Download File node in n8n

HTTP Request

Our next node is the HTTP Request node which will call the Eagle Doc backend. The "Method" to use is "POST" and the "URL" for the finance endpoint is: https://de.eagle-doc.com/api/finance/v1/processing. As the Eagle Doc backend uses an API key, you can set "Authentication" to "None". The "Send Headers" option needs to be activated and the content of the parameter for the header with the name "api-key" needs to be your Eagle Doc API key which you have received via the dashboard.

Configuring HTTP Request Headers for Eagle Doc API

Next, still in the HTTP Request node you need to set up the "Body Content Type". The type needs to be "Form-Data". Additionally the "Body Parameters" need to be set to "n8n Binary File". As name you have to set it to "file" and "Input Data Field Name" needs to be "data". This is how you receive the information from the previous node (see Download file).

Configuring HTTP Request Body for Eagle Doc API

Edit Fields

Like before, if you have executed the previous node, you can drag and drop the information which were provided by the Eagle Doc API directly. Additionally you can type the field names also like shown below.

Editing fields in n8n

Append row in sheet

In order to append information to a google sheet, we need to create one. So create a new google sheet in a folder of your choice. Add the following header information in the file: "Vendor", "Invoice Date", "Price". An example is shown below.

Example Google Sheet for invoice data

The next step is to configure the "Append row in sheet". This node you will find when you search for "Google Sheets" in the search nodes panel of n8n. Like in our previous step to select the folder, we use the same approach and use the url of the file. So copy the url of the document in the "Document" section with the "By URL" configuration. Additionally you need to select in "Sheet" the tab on where you want to add the information. In our example it is "Tabellenblatt1". In this example we will map the data manually to the columns so select in "Mapping Column Mode" the option "Map Each Column Manually". Now you can again, either drag and drop the information accordingly or write it like shown below.

Configuring Append to Sheet node in n8n

Final Run

We have now configured everything for our basic workflow to extract invoice information automatically. You can publish your workflow and let it run automatically whenever a new invoice is uploaded to the google drive folder. For testing, you can also trigger it manually and see the newly added information in your invoice google sheet.

Final Google Sheet with extracted data
Eagle Doc

Ready to
automate your invoice processing?

Sign up for Eagle Doc today and get your free API key to start building powerful workflows with n8n.

Get Started for Free