Invoice Data Extraction using DocSumo and Excel Export - n8n Workflow

Use this powerful n8n workflow to automatically extract detailed invoice information using DocSumo, structure the line items, and export the comprehensive results directly to a downloadable Excel file. This n8n automation template saves hours of manual data entry.

Workflow Preview

Ready to automate?

Download this n8n workflow template and start using it instantly.

Who is this best for?

Accountants and Finance teams needing to digitize and standardize invoice data.
Businesses processing a high volume of vendor invoices.
Users looking for advanced document processing n8n templates.
Technical users who want to see how to integrate specialized document AI services into an n8n workflow.

Overview

Manually entering data from invoices into spreadsheets is time-consuming and error-prone. This specialized n8n workflow solves this problem by creating a robust, automated pipeline.

Starting with an n8n trigger, it accepts an invoice document (PDF or image), leverages the power of DocSumo's AI to extract highly structured details—including complex line items and tax data—and then uses a custom n8n node (Code) to flatten and standardize the output. Finally, the processed data is converted into a ready-to-use Excel file. This seamless n8n automation ensures accuracy and dramatically speeds up financial record keeping. This specific n8n workflow demonstrates best practices for handling binary data and external API calls.

How it Works

This automation operates in a sequential, six-step process starting from the initial file submission:


  1. Input Trigger: The n8n workflow starts with an 'On form submission' n8n trigger. The user uploads an invoice file (e.g., PDF) via the hosted n8n form.

  2. DocSumo Upload: The file is immediately sent to the DocSumo API via an HTTP Request n8n node. This uploads the invoice and initiates the AI-based data extraction, specifying the document type as 'invoice'.

  3. Check Document Status: A subsequent HTTP Request n8n node queries the DocSumo API using the unique document ID to ensure the processing is complete and fetches detailed status information.

  4. Fetch Simplified Data: A third HTTP Request n8n node retrieves the fully extracted, simplified JSON data containing all fields recognized by DocSumo, including header details and line items.

  5. Data Transformation (Code): The most crucial step of this n8n workflow is the Code n8n node. It executes JavaScript logic to meticulously parse the nested DocSumo JSON structure. It extracts header fields (like Invoice Number, Buyer/Seller names, and Total Due) and merges this header data with every individual line item. This ensures each row in the final spreadsheet contains both the line item details and the related invoice header data, resulting in a perfectly flattened structure suitable for spreadsheet export.

  6. Excel Conversion: The final n8n node, 'Convert to File', takes the structured JSON array and transforms it into a downloadable Excel (xls) file, completing the automated data pipeline.

Installation Guide

To deploy and use this powerful n8n workflow template, follow these steps:


  1. Import: Copy the provided n8n workflow JSON and import it into your n8n instance.

  2. DocSumo Credentials: You must configure the Generic Credential used in the HTTP Request n8n node steps (Upload, Detail, Data Fetch). This requires setting up HTTP Header Authentication for DocSumo using your API Key.

Header Name: X-API-KEY
Header Value: Your DocSumo API Key.

  1. Activate Trigger: Ensure the 'On form submission' n8n trigger node is active. You can then use the provided webhook URL to share the form with users or embed it.

  2. Customization (Optional): Review the 'Code' n8n node. If DocSumo's output structure changes, or if you need to include or exclude specific fields, this is where you customize the data transformation logic of the n8n workflow.

Node Details

On form submission (n8n trigger): The entry point for the n8n workflow. It is configured to accept a single file input named 'file' via a public web form.
HTTP Request (DocSumo Upload): Sends the uploaded file binary data to DocSumo. Key settings include Method: POST, Content Type: multipart-form-data, and using binary data mapping for the file parameter. Authentication is handled by a Generic HTTP Header credential.
HTTP Request 1 & 2 (DocSumo Detail & Data): These nodes dynamically construct their URLs using expressions ({{ $json.data.document[0].doc_id }}) to fetch the processing results and the final simplified JSON data from DocSumo, relying on the outputs of previous n8n node steps.
Code (n8n node): Essential for data flattening. This node iterates through the extracted invoice data, pulling header information (like invoice number and buyer details) and combining it with line-item specifics (quantity, unit price, tax components) to create a clean, denormalized array of JSON objects.


  • Convert to File (n8n node): Configured to perform the xls operation, converting the structured JSON output from the 'Code' node into a binary Excel file ready for download or subsequent storage actions.

Related n8n Workflows

Free

Nodes: 5 Nodes
Updated: December 26 2025
View all
Created by
Anurag
Anurag

Featured*