See llms.txt for all machine-readable content.

Back to Templates

Log, validate, and track Brazilian boletos with Gmail, forms, and Google Sheets

Quick overview

This workflow captures Brazilian boleto payment slips from Gmail PDF attachments or an n8n form, validates and decodes their barcode data, logs results to Google Sheets, and sends Gmail reminders for unpaid boletos that are overdue or due within 3 days.

How it works

  1. Triggers when a new Gmail email arrives with PDF attachments or when a user submits the n8n form with a digitable line/barcode.
  2. Extracts text from each PDF attachment and pulls candidate digitable lines plus any printed due date and “Valor do documento” amount.
  3. Decodes the digitable line/barcode, reconstructs the 44-digit barcode, and validates FEBRABAN check digits while deriving boleto type, bank/segment, amount, and due date.
  4. Compares barcode-derived values to printed values (when provided) and routes invalid or mismatching boletos to a Review log in Google Sheets.
  5. Reads the existing Boletos tab in Google Sheets to detect duplicates, appends new valid boletos to the Boletos tab, and logs possible double payments to the Review tab.
  6. On a daily 8:00 schedule and after new boleto entries, reads unpaid boletos from Google Sheets, filters those overdue or due within 3 days, and sends a plain-text reminder email via Gmail.

Setup

  1. Create a Google Sheets spreadsheet with two tabs named “Boletos” and “Review” and add the required header columns used by the workflow.
  2. Add Gmail credentials (for the Gmail Trigger and sending emails) and Google Sheets credentials, then replace all occurrences of YOUR_SHEET_ID with your spreadsheet ID.
  3. Set the recipient address in the Gmail “Send reminder email” step and adjust the Gmail search query (has:attachment filename:pdf) if you want to narrow which emails are processed.
  4. Review the form authentication setting (n8n user auth by default) and switch to Basic Auth if you need external users to submit boletos.
  5. Confirm your workflow time zone in n8n settings so due-date comparisons and the 8:00 schedule run as expected.

Requirements

  • Gmail account (OAuth2) for the trigger and the reminder emails, plus a Google Sheets account with access to the spreadsheet.

Customization

  • Change the 3-day window in "Unpaid and due within 3 days", narrow the Gmail search to a label or sender, or type a date in the Paid On column to stop reminders for a boleto.

Additional info

Limitations: a valid barcode does not prove the boleto is genuine, so confirm the beneficiary in your bank app before paying. Scanned or password-protected PDFs have no text layer and are not read; paste the line in the form instead. Sheet reads and writes are not atomic, so two runs at the same moment could log the same boleto twice.