See llms.txt for all machine-readable content.

Back to Templates

Close monthly accounting documents from Dropbox with Google Drive, Gmail and OpenAI

Quick overview

This workflow mirrors recent month folders from Dropbox to a shared Google Drive archive and, twice a month, uses OpenAI to recognize and validate required accounting documents, then emails you a checklist and creates a Gmail draft to your accountant when the month is complete.

How it works

  1. Runs on schedules (daily at 07:50 and on the 5th and 12th at 09:00) or manually, and branches into Drive mirroring, month-end document checking, or error notification.
  2. Lists the Dropbox archive under your configured root, selects only recent months, and creates any missing year/month folders in Google Drive before uploading files that aren’t already present.
  3. For the month being checked, reads expected document rules from an n8n Data Table and, if no active rules exist, emails you instructions and optionally inserts example rows into the table.
  4. Lists the relevant Dropbox folders, compares files against previously stored results in n8n Data Tables, and selects only new or changed candidates to analyze.
  5. Downloads candidate files from Dropbox, extracts text from the first pages of PDFs, and sends file context to OpenAI to classify document type, period, issuer, and confidence with structured output.
  6. Compiles what’s missing and what needs review (duplicates, empty/broken PDFs, wrong month, low-confidence matches), emails you the checklist via Gmail, and creates a Gmail draft to the accountant with a document index when the month is complete.
  7. In live mode, stores the month status and AI readings in n8n Data Tables to avoid redrafting closed months unless files change.

Setup

  1. Add credentials for Dropbox OAuth2, Google Drive, Gmail, and OpenAI (Chat Model) used by the workflow.
  2. Update the Settings values (yourEmail, accountantEmail, dropboxRoot, driveFolderId, timezone, and set mode to test or live) to match your environment.
  3. Run the workflow once to create the n8n Data Tables (Expected documents, Documents read, Month closing), then edit Expected documents rules (folder, rule, match, where) and set active=true for the documents you want to validate.

Requirements

  • Dropbox, Google Drive, Gmail and OpenAI accounts, and an n8n version with data tables.

Customization

  • Set readWithAI to false to check by file name only; tune minConfidence, maxFilesToRead and maxTextChars to balance accuracy and cost; lookbackDays and monthFolderFilter decide which months are mirrored; monthOverride checks a specific month.

Additional info

Nothing on Drive is ever overwritten or deleted, and empty files are not copied. Each file goes to OpenAI only once, unless it changes. The draft for the accountant is prepared once per month: to prepare it again, delete the month's row in the Month closing table. Emails are in Italian on purpose, as an Italian accountant expects them.