Send specific PDF attachments from Gmail to Google Drive using OpenAI
Configured with Gmail Trigger, Google Drive, Open Ai, Read Pdf. Review the connections and setup before adapting this template.
Node categories in this workflow
- Files / media
- Transform
- Routing
- Code
- AI & models
- Trigger
Icons describe general node roles, inferred from node types. Inspect the parameters for the configured action.
Drag to pan; use + and − to zoom. Reconstructed from the exported node positions; nothing runs here. Dashed lines represent non-main connections. Full node names and notes appear below.
How it works
The exported workflow contains the following configured nodes. Their connections are shown above; inspect the JSON for the complete logic, expressions, and external actions.
| Node | Category | Type | Operation |
|---|---|---|---|
| Read PDF | Files / media | Read Pdf | See node parameters |
| Configure | Transform | Edit Fields | See node parameters |
| Is PDF | Routing | If | See node parameters |
| Not a PDF | Routing | No Op | See node parameters |
| Is matched | Routing | If | See node parameters |
| This is a matched PDF | Routing | No Op | See node parameters |
| This is not a matched PDF | Routing | No Op | See node parameters |
| Iterate over email attachments | Code | Code | See node parameters |
| OpenAI matches PDF textual content | AI & models | Open Ai | See node parameters |
| Merge | Transform | Merge | See node parameters |
| Upload file to folder | Files / media | Google Drive | See node parameters |
| On email received | Trigger | Gmail Trigger | See node parameters |
| Ignore large PDFs | Routing | No Op | See node parameters |
| Is text within token limit? | Routing | If | See node parameters |
| Has attachments? | Routing | If | See node parameters |
| There are no attachments | Routing | No Op | See node parameters |
Setup
- Download the JSON and import it into an isolated n8n instance. Leave the workflow inactive.
- Connect your own credentials through n8n’s credential store. Replace
REPLACE_WITH_*values with your resource identifiers. - Inspect API destinations, Code nodes, database queries, file paths, and outbound actions.
- Run with synthetic data and harmless destinations. Enable triggers only after checking the actual outputs.
Requirements
An n8n instance with the listed node types and compatible versions. Service-connected workflows may require accounts, credentials, or paid APIs.
Credential types declared in the source
gmailOAuth2googleDriveOAuth2ApiopenAiApi
Workflow notes
Send specific PDF attachments from Gmail to Google Drive using OpenAI
Send specific PDF attachments from Gmail to Google Drive using OpenAI
DISCLAIMER: You may have varying success when using this workflow so be prepared to validate the correctness of OpenAI's results.
This workflow reads PDF textual content and sends the text to OpenAI. Attachments of interest will then be uploaded to a specified Google Drive folder. For example, you may wish to send invoices received from an email to an inbox folder in Google Drive for later processing. This workflow has been designed to easily change the search term to match your needs. See the workflow for more details.
How it works
- Triggers off on the
On email receivednode. - Iterates over the attachments in the email.
- Uses the
OpenAInode to filter out the attachments that do not match the search term set in theConfigurenode. You could match on various PDF files (i.e. invoice, receipt, or contract). - If the PDF attachment matches the search term, the workflow uses the
Google Drivenode to upload the PDF attachment to a specific Google Drive folder.
Workflow written by David Sha.
Configuration
Configuration
Match on(required): What should OpenAI's search term be? Examples: invoice, callsheet, receipt, contract, payslip.
Google Drive folder to upload matched PDFs(required): Paste the link of the GDrive folder, an example has been provided but will need to change to a folder you own.
maxTokenSize(required): The maximum token size for the model you choose. See possible models from OpenAI here.
replyTokenSize(required): The reply's maximum token size. Default is 300. This determines how much text the AI will reply with.
Send specific PDF attachments from Gmail to Google Drive using OpenAI
Send specific PDF attachments from Gmail to Google Drive using OpenAI
Purpose and structure
This folder contains the Send specific PDF attachments from Gmail to Google Drive using OpenAI workflow. Its executable nodes use code, gmailTrigger, googleDrive, if, merge, noOp, openAi, readPDF, set. The table and connection map below are derived from the JSON, not an inferred guarantee of behavior.
Setup
Import inactive. Configure your own credentials and replace REPLACE_WITH_* values. Review external destinations and Code nodes before running.
Entry points
On email received
Verification
Sanitized source candidate; not runtime-tested. This overview is generated from node metadata. Read the folder README for the connection map, credential types, and license.
Attribution
https://github.com/Zie619/n8n-workflows/blob/94007c1445d9258a7da116646b79473e7c7c3282/workflows/Code/0298_Code_Readpdf_Send_Triggered.json MIT; preserve source notices.