# OCR document processing from LINE/Gmail with OpenAI: n8n workflow

> Started by another system calling it, and works across Gmail, Google Drive and Google Sheets. It hands the judgement calls to OpenAI.

Source: https://millionrounds.com/workflow/ocr-document-processing-from-line-gmail-with-openai (Millionrounds; every figure on the page links to its filing or article)

[Automation library](https://millionrounds.com/workflows) · [Documents and files](https://millionrounds.com/workflows?category=Documents+and+files#library)

# OCR document processing from LINE/Gmail with OpenAI

Started by another system calling it, and works across Gmail, Google Drive and Google Sheets. It hands the judgement calls to OpenAI. 17 steps, 1 branch, 1 loop or waits: a working afternoon to understand properly.

Medium Calls a model: OpenAI

[Download free](https://millionrounds.com/login?next=%2Fapp%2Fworkflow%2Focr-document-processing-from-line-gmail-with-openai)

**17 steps** Medium: a working afternoon

**1** Branch: places the flow splits

**1** Loop or waits

**3** Services it connects to

## The flow

Starts it 2 Model 2 Logic 8 Service 5

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

- 1 **LINE Webhook** Webhook *Starts it*
- 2 **Gmail IMAP Trigger** Gmail trigger *Starts it*
- 3 **Workflow Configuration** Set *Logic*
- 4 **Tag Source - EMAIL** Set *Logic*
- 5 **If** If *Logic*
- 6 **Code in JavaScript** Code *Logic*
- 7 **HTTP Request** Http Request *Service*
- 8 **Merge Triggers** Merge *Logic*
- 9 **Tag Source - LINE** Set *Logic*
- 10 **Upload to Google Drive** Google Drive *Service*
- 11 **Convert to Base64** Code *Logic*
- 12 **HTTP Request2** Http Request *Service*
- 13 **Analyze image** Open Ai *Model*
- 14 **Wait** Wait *Logic*
- 15 **Message a model** Open Ai *Model*
- 16 **Append row in sheet** Google Sheets *Service*
- 17 **Create Gmail Draft** Gmail *Service*

## How it's built

- **Starts on:** Another system calling it
- **Steps:** 17, with 1 branch, 1 loop or waits
- **Size:** Medium: a working afternoon
- **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 another system calling it.

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?

Plan an afternoon. 17 steps is enough that you should read each one before running it.

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 17 steps before you point it at anything that matters.

## Run it in n8n

- **Create your n8n account** Free to start. n8n is where the workflow runs. [Create an n8n account ↗](https://millionrounds.com/n8n)
- **Download the workflow** Free with a Millionrounds account. [Download free](https://millionrounds.com/login?next=%2Fapp%2Fworkflow%2Focr-document-processing-from-line-gmail-with-openai)
- **Paste it into n8n** Open a new workflow in n8n and paste. Then connect your own accounts.

Stored with the author's traces removed: canvas notes, instance identifiers, saved credential names and any live document they had left behind.

## Connects to

Each opens the other workflows that use it.

[Gmail](https://millionrounds.com/workflows?service=Gmail#library)[Google Drive](https://millionrounds.com/workflows?service=Google+Drive#library)[Google Sheets](https://millionrounds.com/workflows?service=Google+Sheets#library)

## Workflows like it

Also documents and files, with the same services where possible, closest in size first.

- [**AI-powered Product Hunt data collection & translation** 17 steps · calls a model · Google Sheets](https://millionrounds.com/workflow/ai-powered-product-hunt-data-collection-and-translation)
- [**Aggregate & update documentation from Slack, Teams & GitHub** 17 steps · calls a model · GitHub, Gmail](https://millionrounds.com/workflow/aggregate-and-update-documentation-from-slack-teams-and-gith)
- [**Create an auto-journal from WhatsApp with Gemini** 17 steps · calls a model · Google Docs, Google Drive](https://millionrounds.com/workflow/create-an-auto-journal-from-whatsapp-with-gemini)
- [**Generate Anki flash cards for language learning** 17 steps · calls a model · Google Drive, Google Sheets](https://millionrounds.com/workflow/generate-anki-flash-cards-for-language-learning)
- [**Validate shipments & generate freight documents with OpenAI** 17 steps · calls a model · Gmail, Google Drive](https://millionrounds.com/workflow/validate-shipments-and-generate-freight-documents-with-opena)
- [**Automated n8n workflow backup to Google Drive** 17 steps · Google Drive](https://millionrounds.com/workflow/automated-n8n-workflow-backup-to-google-drive)
