Automation library · Money admin

Extract invoice data from Gmail PDFs

Started by an arriving email, and works across Gmail, Google Drive and Google Sheets. It hands the judgement calls to OpenAI. 22 steps, 1 branch, 3 loops or waits: large, and worth reading before you trust it with anything live.

LargeCalls a model: OpenAI

22 stepsLarge: read it before trusting it with anything live
1Branch: places the flow splits
3Loops or waits
3Services it connects to

The flow

Starts it 2Model 5Logic 9Service 6

The steps in the order they run, from what starts it.

  1. 1Chat model - ExtractionLm Chat Open AiModel
  2. 2Output Parser - Invoice fieldsOutput Parser StructuredModel
  3. 3Chat model - Parser auto-fixLm Chat Open AiModel
  4. 4Check inbox hourlyGmail triggerStarts it
  5. 5Run manually for a date rangeManual triggerStarts it
  6. 6Extract invoice fields with AIAgentModel
  7. 7Auto-fixing Output ParserOutput Parser AutofixingModel
  8. 8Skip unwanted sendersFilterLogic
  9. 9Get emails in a date rangeGmailService
  10. 10Any tax found?IfLogic
  11. 11Pull PDF attachments outCodeLogic
  12. 12Add invoice data to sheetGoogle SheetsService
  13. 13Skip and continueWaitLogic
  14. 14Combine PDFs and folderMergeLogic
  15. 15Find this month folder in DriveGoogle DriveService
  16. 16Pause before next PDFWaitLogic
  17. 17Loop over PDFsSplit In BatchesLogic
  18. 18Upload PDF to DriveGoogle DriveService
  19. 19Download PDF backGoogle DriveService
  20. 20Build Drive linksCodeLogic
  21. 21Combine file and linksMergeLogic
  22. 22Read text from the PDFExtract From FileService

How it's built

Starts on
An arriving email
Steps
22, with 1 branch, 3 loops or waits
Size
Large: read it before trusting it with anything live
Connects to
Gmail, Google Drive, Google Sheets
Model
OpenAI

Questions

What does it need to run?

An n8n account, plus your own Gmail, Google Drive and Google Sheets accounts, and a key for OpenAI. You connect your own accounts after importing it; none are included.

What starts it?

It starts on an arriving email.

Does it use AI?

Yes. It calls OpenAI. Model calls are billed by the provider, not by n8n.

How long does it take to set up?

Take your time. At 22 steps it is large: read it before trusting it with anything live.

How do I import it?

Copy the workflow, open a new workflow in n8n and paste. The steps appear on the canvas, ready for your own accounts.

Before you run it

Nothing here has been tested by us. It is somebody's working automation, read and described from its own steps. Treat the connections it wants as a list of accounts it will touch, and read the 22 steps before you point it at anything that matters.