Use this powerful n8n workflow to automatically process uploaded medical faxes or complex PDFs. Leverage Google Gemini 2.0 for data extraction, structure the output using the LLM Chain n8n node, and store the final results in Google Sheets.
Download this n8n workflow template and start using it instantly.
Healthcare administrators and clerks who need to digitize patient information from scanned forms (faxes or PDFs).
Automation specialists looking for advanced examples of multi-stage AI processing within an n8n workflow.
Developers needing to implement robust document processing n8n templates that handle complex, unstructured input.
Users aiming to use the Google Gemini API effectively within an n8n node environment.
Processing scanned documents like medical faxes or complex administrative PDFs is notoriously difficult due to variable formats, handwriting, and low image quality. This advanced n8n workflow solves this by utilizing Google's powerful Gemini 2.0 Flash model in a two-stage process.
First, the document is sent to Gemini with a highly detailed prompt instructing the AI to act as an expert document analyzer, focusing on extracting specific medical and administrative fields (like Patient ID, Prognosis, Allergies, and Date Signed). Second, a subsequent AI call (using the LLM Chain n8n node) enforces a strict JSON schema, ensuring that the extracted text is converted into clean, usable, structured data. Finally, this data is reliably appended to a Google Sheet, making it an essential n8n template for reliable data entry from unstructured sources. This n8n workflow dramatically reduces manual data entry time and errors.
This automation initiates when a user uploads a PDF file using the integrated Form Trigger n8n node, making it a flexible and accessible n8n trigger point.
On form submission n8n trigger receives the fax/PDF file. The file is immediately uploaded and saved to a specified Google Drive folder, followed by a quick download step to retrieve the binary data.Define Prompt n8n node injects a detailed, multi-point instruction set, guiding the Gemini model on exactly what medical and administrative fields to extract from the complex document.Call Gemini 2.0 Flash HTTP Request node sends the PDF binary and the detailed prompt to the Gemini API. The AI performs the primary OCR and semantic extraction, returning the data as unstructured text.Code n8n node cleans the raw text output, removing common markdown artifacts (like * or ) left by the AI, preparing it for strict structuring.Basic LLM Chain n8n node, powered by the Google Gemini Chat Model and the Structured Output Parser, takes the cleaned text. It applies a strict JSON schema, forcing the extracted data (Patient Name, DOB, Allergies, etc.) into a predetermined, reliable JSON format.Append row in sheet n8n node maps the keys from the structured JSON output directly to corresponding columns, appending the clean data as a new row in Google Sheets. This completes the end-to-end n8n workflow.To set up this powerful n8n workflow, follow these steps:
Folder ID where you want the original fax documents to be stored.Document ID. Ensure the column mapping defined in the node matches the header row names in your target spreadsheet (e.g., 'Patient Name', 'Allergies').This n8n template utilizes several advanced and custom n8n nodes:
On form submission (n8n Trigger):
Function: Acts as the entry point, allowing users to upload the fax/PDF file via a simple web form.
Key Configuration: Configured to accept a single file upload named 'Upload File'.
Define Prompt (Set n8n node):
Function: Prepares the highly specific instruction set for the AI, detailing required extractions from a medical form (patient data, medical codes, instructions, etc.).
Key Configuration: Contains a multi-line string value defining the role of the AI as an "expert document analyzer".
Call Gemini 2.0 Flash (HTTP Request n8n node):
Function: Executes the core extraction by sending the binary PDF data and the defined prompt to the specialized Gemini model endpoint.
Key Configuration: Uses a POST method to the Gemini API, injecting application/pdf inline data along with the prompt.
Code (n8n node):
Function: Cleans the raw text response from the initial AI call, removing markdown artifacts and ensuring a clean extractedText property.
Basic LLM Chain (Langchain n8n node):
Function: Enforces structured output. It uses the cleaned text and coordinates the Google Gemini Chat Model with the Structured Output Parser to strictly match a defined JSON schema.
Key Configuration: The prompt includes a mandatory schema definition for fields like PatientID, DateOfBirth, and Prognosis.
Append row in sheet (Google Sheets n8n node):
Function: The final action, which saves the strictly parsed data into a spreadsheet for permanent storage and accessibility.
* Key Configuration: Uses 'Append' operation and maps multiple extracted fields (e.g., 'Safety Measures', 'Allergies') to specific sheet columns.
Build a sophisticated AI Data Analytics Department using this n8n workflow. The CDO Agent delegates tasks to specialized agents (Data Science, BI, ML) powered by OpenAI O3 and GPT-4.1-mini for high efficiency.

Use this powerful n8n workflow to automatically summarize daily meetings from Google Calendar using the Gemini AI agent and post the results directly to Slack. Integrate this n8n template for improved productivity.

Use this robust n8n workflow to automatically backup and version control all your active n8n workflows to a GitHub repository, ensuring data safety and easy rollback.

Use this powerful n8n workflow to synchronize database alerts between Notion and SIGNL4. Automate incident tracking, status updates, and resolution using this n8n template.

Use this efficient n8n workflow to automatically check multiple timezones daily for impending Daylight Saving Time changes and send proactive Slack and email alerts.

Workflow automation can help automate your routine activities and help saves $$$, as well as hours of time. As a boutique tech consulting company, Intuz help businesses with custom AI/ML, AI Workflow Automations, and software development. Automate your business workflow for: Sales Marketing Accounting Finance Operations E-Commerce Customer Support Admin & Backoffice Logistics & Supply Chain







































