# Automate legal lien documents with Gemini and Apify: n8n workflow

> Started by a change in a Google Sheet, and works across Gmail, Google Docs, Google Drive and Google Sheets. It hands the judgement calls to Gemini.

Source: https://millionrounds.com/workflow/automate-legal-lien-documents-with-gemini-and-apify (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)

# Automate legal lien documents with Gemini and Apify

Started by a change in a Google Sheet, and works across Gmail, Google Docs, Google Drive and Google Sheets. It hands the judgement calls to Gemini. 22 steps, 1 branch: large, and worth reading before you trust it with anything live.

Large Calls a model: Gemini

[Download free](https://millionrounds.com/login?next=%2Fapp%2Fworkflow%2Fautomate-legal-lien-documents-with-gemini-and-apify)

**22 steps** Large: read it before trusting it with anything live

**1** Branch: places the flow splits

**0** Loops or waits

**4** Services it connects to

## The flow

Starts it 2 Model 2 Logic 1 Service 17

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

- 1 **Google Gemini Chat Model1** Lm Chat Google Gemini *Model*
- 2 **Intermediate data received** Google Sheets trigger *Starts it*
- 3 **Form submitted trigger** Google Sheets trigger *Starts it*
- 4 **Property Information Extractor** Information Extractor *Model*
- 5 **If** If *Logic*
- 6 **Apify Playwright script to find property info** Http Request *Service*
- 7 **Add Intermediate Info to Google Sheets** Google Sheets *Service*
- 8 **Create folder For Output Files** Google Drive *Service*
- 9 **Get file for property** Http Request *Service*
- 10 **Playwright error inform** Gmail *Service*
- 11 **Approve Through Email** Gmail *Service*
- 12 **Make Copy of Template** Google Drive *Service*
- 13 **Transform to base64** Extract From File *Service*
- 14 **Change Custom Variables** Google Docs *Service*
- 15 **Upload legal doc** Google Drive *Service*
- 16 **Generate PDF** Google Drive *Service*
- 17 **Call Gemini API for legal desc** Http Request *Service*
- 18 **Add PDF To Drive** Google Drive *Service*
- 19 **Property metadata** Http Request *Service*
- 20 **Move file in Google Drive** Google Drive *Service*
- 21 **Update Creation** Google Sheets *Service*
- 22 **Notify complete** Gmail *Service*

## How it's built

- **Starts on:** A change in a Google Sheet
- **Steps:** 22, with 1 branch
- **Size:** Large: read it before trusting it with anything live
- **Connects to:** Gmail, Google Docs, Google Drive, Google Sheets
- **Model:** Gemini

## Questions

What does it need to run?

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

What starts it?

It starts on a change in a Google Sheet.

Does it use AI?

Yes. It calls Gemini. 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.

## 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%2Fautomate-legal-lien-documents-with-gemini-and-apify)
- **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 Docs](https://millionrounds.com/workflows?service=Google+Docs#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.

- [**Classify and file email PDF documents with Gmail and Drive** 22 steps · calls a model · Gmail, Google Drive](https://millionrounds.com/workflow/classify-and-file-email-pdf-documents-with-gmail-and-drive)
- [**Validate supplier onboarding documents with Gemini and Gmail** 22 steps · calls a model · Gmail, Google Drive](https://millionrounds.com/workflow/validate-supplier-onboarding-documents-with-gemini-and-gmail)
- [**Chat with Supabase** 23 steps · calls a model · Gmail, Google Drive](https://millionrounds.com/workflow/chat-with-supabase)
- [**Extract timesheet data with Mistral and Gmail** 23 steps · calls a model · Gmail, Google Drive](https://millionrounds.com/workflow/extract-timesheet-data-with-mistral-and-gmail)
- [**Multilingual YouTube metadata translator with Gemini** 21 steps · calls a model · Google Sheets, YouTube](https://millionrounds.com/workflow/multilingual-youtube-metadata-translator-with-gemini)
- [**Process documents & build semantic search with OpenAI** 23 steps · calls a model · Google Drive, Qdrant](https://millionrounds.com/workflow/process-documents-and-build-semantic-search-with-openai)
