Extract and process information directly from PDF using Claude and Gemini n8n Workflow Template

n8n workflow template · 6 nodes · Google Drive

Extract and process information directly from PDF using Claude and Gemini is a free n8n workflow template that starts when you run it manually in the n8n editor and works with Google Drive. It has 6 nodes and no AI nodes. The notes inside the workflow say: “This prompt is used in both Gemini’s and Claude’s calls to define what information should be extracted and processed.” To run it, you add your own credentials for Anthropic API, Google Drive OAuth2 and Google Gemini (PaLM) API.

At a glance

Trigger
Manual Trigger (When clicking 'Test workflow')
Nodes
6
Apps
Google Drive
AI nodes
None
Credentials
3 types
Category
Spreadsheets, databases and docs

Apps and integrations

  • Google Drive

Node types used

  • Manual Trigger
  • Extract from File
  • Google Drive
  • HTTP Request
  • Edit Fields (Set)

How it works

The text below comes from the sticky notes inside the workflow. We removed links, code samples and anything that looks like a key or token.

This prompt is used in both Gemini’s and Claude’s calls to define what information should be extracted and processed.

These 2 steps first download the PDF file, and then convert it to base64. This is required by both APIs to process the file.

You can force Claude to output JSON with Prefill response format

You can output the result as JSON by adding the following

or even use a structured output. Check the documentation

Setup notes

The text below comes from the sticky notes inside the workflow. We removed links, code samples and anything that looks like a key or token.

Workflow: Extract data from PDF with Claude 3.5 Sonnet or Gemini 2.0 Flash

  • This workflow helps you compare Claude 3.5 Sonnet and Gemini 2.0 Flash when extracting data from a PDF
  • This workflow extracts and processes the data within a PDF in one single step, instead of calling an OCR and then an LLM”

How it works

  • The initial 2 steps download the PDF and convert it to base64.
  • This base64 string is then sent to both Claude 3.5 Sonnet and Gemini 2.0 Flash to extract information.
  • This workflow is made to let you compare results, latency, and cost (in their dedicated dashboard).

How to use it

  • Set up your Google Drive if not already done
  • Select a document on your Google Drive
  • Modify the prompt in "Define Prompt" to extract the information you need and transform it as wanted.
  • Get a Claude API key and/or Gemini API key
  • Note that you can deactivate one of the 2 API calls if you don't want to try both
  • Test the Workflow

Nodes in this workflow

The 6 nodes in file order (sticky notes excluded). Branches and connections determine execution order in n8n:

  1. When clicking 'Test workflow' (Manual Trigger)
  2. Extract from File (Extract from File)
  3. Google Drive (Google Drive)
  4. Call Gemini 2.0 Flash with PDF Capabilities (HTTP Request)
  5. Call Claude 3.5 Sonnet with PDF Capabilities (HTTP Request)
  6. Define Prompt (Edit Fields (Set))

Credentials you need

  • Anthropic API – used by Call Claude 3.5 Sonnet with PDF Capabilities and Call Gemini 2.0 Flash with PDF Capabilities
  • Google Drive OAuth2 – used by Google Drive
  • Google Gemini (PaLM) API – used by Call Gemini 2.0 Flash with PDF Capabilities

Configure your own credentials after importing. Create each credential in n8n, then select it in the node.

How to import into n8n

  1. Download the JSON file with the button above.
  2. In n8n, open a new workflow, select the ... menu and choose Import from File. You can also paste the JSON straight into the editor canvas.
  3. Open each node that shows a warning and select or create its credential.
  4. Read the notes on the canvas, test the workflow with sample data, then activate it.

Do you need somewhere to run it? Read our guide to self-hosted n8n.

Need this customised?

We can adapt this workflow to your apps, data and process, then deploy and support it.

Contact Us