From c8bf37f0e2a19606b334091921d38935da3e8558 Mon Sep 17 00:00:00 2001 From: nusquama Date: Thu, 13 Nov 2025 14:17:58 +0100 Subject: [PATCH] creation --- ...oice_pdf_upload_to_google_drive_with_spreadsheet_logging.json | 1 + 1 file changed, 1 insertion(+) create mode 100644 workflows/Automatic Gmail Invoice PDF Upload to Google Drive with Spreadsheet Logging-9610/automatic_gmail_invoice_pdf_upload_to_google_drive_with_spreadsheet_logging.json diff --git a/workflows/Automatic Gmail Invoice PDF Upload to Google Drive with Spreadsheet Logging-9610/automatic_gmail_invoice_pdf_upload_to_google_drive_with_spreadsheet_logging.json b/workflows/Automatic Gmail Invoice PDF Upload to Google Drive with Spreadsheet Logging-9610/automatic_gmail_invoice_pdf_upload_to_google_drive_with_spreadsheet_logging.json new file mode 100644 index 000000000..657c904de --- /dev/null +++ b/workflows/Automatic Gmail Invoice PDF Upload to Google Drive with Spreadsheet Logging-9610/automatic_gmail_invoice_pdf_upload_to_google_drive_with_spreadsheet_logging.json @@ -0,0 +1 @@ +{"id":"OOH6DNGDDDuKrcjk","meta":{"templateCredsSetupCompleted":true},"name":"Gmail Invoice PDF to Google Drive and Sheets","tags":[],"nodes":[{"id":"a1b2c3d4-e5f6-7890-abcd-ef1234567890","name":"Gmail Trigger","type":"n8n-nodes-base.gmailTrigger","position":[224,304],"parameters":{"simple":false,"filters":{"sender":[],"labelIds":["CATEGORY_PERSONAL"],"readStatus":"unread"},"options":{"downloadAttachments":true},"pollTimes":{"item":[{"mode":"everyMinute"}]}},"typeVersion":1.1},{"id":"note1-2345-6789-abcd-ef1234567891","name":"Sticky Note","type":"n8n-nodes-base.stickyNote","position":[128,80],"parameters":{"color":5,"width":280,"height":216,"content":"## 📧 Gmail Trigger\nThis node monitors your Gmail inbox for new emails containing invoices. It checks every minute for unread emails with 'invoice' in the subject line and downloads any PDF attachments.\n\n**Configure:** Connect your Gmail account credentials"},"typeVersion":1},{"id":"filter-node-123-456-789-abcdef123456","name":"Has PDF Attachments?","type":"n8n-nodes-base.filter","position":[448,304],"parameters":{"options":{},"conditions":{"options":{"version":1,"leftValue":"","caseSensitive":true,"typeValidation":"strict"},"combinator":"and","conditions":[{"id":"cond123","operator":{"type":"number","operation":"gt"},"leftValue":"={{ Object.keys($binary ?? {}).length }}","rightValue":0},{"id":"45eb8d9f-575d-4920-b236-2ea5be8ade19","operator":{"name":"filter.operator.equals","type":"string","operation":"equals"},"leftValue":"","rightValue":""}]}},"typeVersion":2},{"id":"note2-3456-7890-bcde-f12345678902","name":"Sticky Note1","type":"n8n-nodes-base.stickyNote","position":[432,480],"parameters":{"color":3,"width":260,"height":140,"content":"## 🔍 Filter Check\nThis filter ensures we only process emails that actually have attachments (PDFs). Emails without attachments are filtered out."},"typeVersion":1},{"id":"gdrive-upload-123-456-789-abcdef654321","name":"Upload to Google Drive","type":"n8n-nodes-base.googleDrive","position":[896,304],"parameters":{"name":"={{ $json.filename || 'invoice_' + $now.toFormat('yyyyMMdd_HHmmss') + '.pdf' }}","driveId":{"__rl":true,"mode":"list","value":"My Drive"},"options":{},"folderId":{"__rl":true,"mode":"list","value":"root","cachedResultName":"/ (Root folder)"},"inputDataFieldName":"=attachment_0"},"typeVersion":3},{"id":"note3-4567-8901-cdef-234567890123","name":"Sticky Note2","type":"n8n-nodes-base.stickyNote","position":[864,80],"parameters":{"color":4,"width":300,"height":180,"content":"## 📁 Google Drive Upload\nEach PDF attachment is uploaded to your Google Drive. Files are named using the original filename or a timestamp if not available.\n\n**Configure:** \n- Connect Google Drive credentials\n- Optionally specify a folder ID instead of 'root'"},"typeVersion":1},{"id":"gsheets-append-123-456-789-fedcba098765","name":"Log to Google Sheets","type":"n8n-nodes-base.googleSheets","position":[1120,304],"parameters":{"columns":{"value":{"name":"={{ $json.name }}"},"schema":[{"id":"kind","type":"string","display":true,"removed":false,"required":false,"displayName":"kind","defaultMatch":false,"canBeUsedToMatch":true},{"id":"id","type":"string","display":true,"removed":false,"required":false,"displayName":"id","defaultMatch":true,"canBeUsedToMatch":true},{"id":"name","type":"string","display":true,"removed":false,"required":false,"displayName":"name","defaultMatch":false,"canBeUsedToMatch":true},{"id":"mimeType","type":"string","display":true,"removed":false,"required":false,"displayName":"mimeType","defaultMatch":false,"canBeUsedToMatch":true},{"id":"starred","type":"string","display":true,"removed":false,"required":false,"displayName":"starred","defaultMatch":false,"canBeUsedToMatch":true},{"id":"trashed","type":"string","display":true,"removed":false,"required":false,"displayName":"trashed","defaultMatch":false,"canBeUsedToMatch":true},{"id":"explicitlyTrashed","type":"string","display":true,"removed":false,"required":false,"displayName":"explicitlyTrashed","defaultMatch":false,"canBeUsedToMatch":true},{"id":"parents","type":"string","display":true,"removed":false,"required":false,"displayName":"parents","defaultMatch":false,"canBeUsedToMatch":true},{"id":"spaces","type":"string","display":true,"removed":false,"required":false,"displayName":"spaces","defaultMatch":false,"canBeUsedToMatch":true},{"id":"version","type":"string","display":true,"removed":false,"required":false,"displayName":"version","defaultMatch":false,"canBeUsedToMatch":true},{"id":"webContentLink","type":"string","display":true,"removed":false,"required":false,"displayName":"webContentLink","defaultMatch":false,"canBeUsedToMatch":true},{"id":"webViewLink","type":"string","display":true,"removed":false,"required":false,"displayName":"webViewLink","defaultMatch":false,"canBeUsedToMatch":true},{"id":"iconLink","type":"string","display":true,"removed":false,"required":false,"displayName":"iconLink","defaultMatch":false,"canBeUsedToMatch":true},{"id":"hasThumbnail","type":"string","display":true,"removed":false,"required":false,"displayName":"hasThumbnail","defaultMatch":false,"canBeUsedToMatch":true},{"id":"thumbnailVersion","type":"string","display":true,"removed":false,"required":false,"displayName":"thumbnailVersion","defaultMatch":false,"canBeUsedToMatch":true},{"id":"viewedByMe","type":"string","display":true,"removed":false,"required":false,"displayName":"viewedByMe","defaultMatch":false,"canBeUsedToMatch":true},{"id":"createdTime","type":"string","display":true,"removed":false,"required":false,"displayName":"createdTime","defaultMatch":false,"canBeUsedToMatch":true},{"id":"modifiedTime","type":"string","display":true,"removed":false,"required":false,"displayName":"modifiedTime","defaultMatch":false,"canBeUsedToMatch":true},{"id":"modifiedByMeTime","type":"string","display":true,"removed":false,"required":false,"displayName":"modifiedByMeTime","defaultMatch":false,"canBeUsedToMatch":true},{"id":"modifiedByMe","type":"string","display":true,"removed":false,"required":false,"displayName":"modifiedByMe","defaultMatch":false,"canBeUsedToMatch":true},{"id":"owners","type":"string","display":true,"removed":false,"required":false,"displayName":"owners","defaultMatch":false,"canBeUsedToMatch":true},{"id":"lastModifyingUser","type":"string","display":true,"removed":false,"required":false,"displayName":"lastModifyingUser","defaultMatch":false,"canBeUsedToMatch":true},{"id":"shared","type":"string","display":true,"removed":false,"required":false,"displayName":"shared","defaultMatch":false,"canBeUsedToMatch":true},{"id":"ownedByMe","type":"string","display":true,"removed":false,"required":false,"displayName":"ownedByMe","defaultMatch":false,"canBeUsedToMatch":true},{"id":"downloadRestrictions","type":"string","display":true,"removed":false,"required":false,"displayName":"downloadRestrictions","defaultMatch":false,"canBeUsedToMatch":true},{"id":"capabilities","type":"string","display":true,"removed":false,"required":false,"displayName":"capabilities","defaultMatch":false,"canBeUsedToMatch":true},{"id":"viewersCanCopyContent","type":"string","display":true,"removed":false,"required":false,"displayName":"viewersCanCopyContent","defaultMatch":false,"canBeUsedToMatch":true},{"id":"copyRequiresWriterPermission","type":"string","display":true,"removed":false,"required":false,"displayName":"copyRequiresWriterPermission","defaultMatch":false,"canBeUsedToMatch":true},{"id":"writersCanShare","type":"string","display":true,"removed":false,"required":false,"displayName":"writersCanShare","defaultMatch":false,"canBeUsedToMatch":true},{"id":"permissions","type":"string","display":true,"removed":false,"required":false,"displayName":"permissions","defaultMatch":false,"canBeUsedToMatch":true},{"id":"permissionIds","type":"string","display":true,"removed":false,"required":false,"displayName":"permissionIds","defaultMatch":false,"canBeUsedToMatch":true},{"id":"originalFilename","type":"string","display":true,"removed":false,"required":false,"displayName":"originalFilename","defaultMatch":false,"canBeUsedToMatch":true},{"id":"fullFileExtension","type":"string","display":true,"removed":false,"required":false,"displayName":"fullFileExtension","defaultMatch":false,"canBeUsedToMatch":true},{"id":"fileExtension","type":"string","display":true,"removed":false,"required":false,"displayName":"fileExtension","defaultMatch":false,"canBeUsedToMatch":true},{"id":"md5Checksum","type":"string","display":true,"removed":false,"required":false,"displayName":"md5Checksum","defaultMatch":false,"canBeUsedToMatch":true},{"id":"sha1Checksum","type":"string","display":true,"removed":false,"required":false,"displayName":"sha1Checksum","defaultMatch":false,"canBeUsedToMatch":true},{"id":"sha256Checksum","type":"string","display":true,"removed":false,"required":false,"displayName":"sha256Checksum","defaultMatch":false,"canBeUsedToMatch":true},{"id":"size","type":"string","display":true,"removed":false,"required":false,"displayName":"size","defaultMatch":false,"canBeUsedToMatch":true},{"id":"quotaBytesUsed","type":"string","display":true,"removed":false,"required":false,"displayName":"quotaBytesUsed","defaultMatch":false,"canBeUsedToMatch":true},{"id":"headRevisionId","type":"string","display":true,"removed":false,"required":false,"displayName":"headRevisionId","defaultMatch":false,"canBeUsedToMatch":true},{"id":"isAppAuthorized","type":"string","display":true,"removed":false,"required":false,"displayName":"isAppAuthorized","defaultMatch":false,"canBeUsedToMatch":true},{"id":"linkShareMetadata","type":"string","display":true,"removed":false,"required":false,"displayName":"linkShareMetadata","defaultMatch":false,"canBeUsedToMatch":true},{"id":"inheritedPermissionsDisabled","type":"string","display":true,"removed":false,"required":false,"displayName":"inheritedPermissionsDisabled","defaultMatch":false,"canBeUsedToMatch":true}],"mappingMode":"autoMapInputData","matchingColumns":["id"],"attemptToConvertTypes":false,"convertFieldsToString":false},"options":{},"operation":"appendOrUpdate","sheetName":{"__rl":true,"mode":"name","value":""},"documentId":{"__rl":true,"mode":"id","value":""}},"typeVersion":4.5},{"id":"note4-5678-9012-def0-345678901234","name":"Sticky Note3","type":"n8n-nodes-base.stickyNote","position":[896,496],"parameters":{"color":6,"width":320,"height":240,"content":"## 📊 Google Sheets Logging\nRecords invoice details in a spreadsheet including:\n- Date/time received\n- Sender email\n- Subject line\n- PDF filename\n- Google Drive link\n- File and Email IDs\n\n**Configure:**\n- Connect Google Sheets credentials\n- Add your spreadsheet ID\n- Ensure sheet has headers matching the column names"},"typeVersion":1},{"id":"gmail-mark-read-123-456-789-0987654321ab","name":"Mark Email as Read","type":"n8n-nodes-base.gmail","position":[1344,304],"webhookId":"4e776efa-c75c-428c-aad3-a959fa6fe667","parameters":{"messageId":"={{ $('Gmail Trigger').item.json.id }}","operation":"markAsRead"},"typeVersion":2.1},{"id":"note5-6789-0123-ef01-456789012345","name":"Sticky Note4","type":"n8n-nodes-base.stickyNote","position":[1376,112],"parameters":{"color":2,"width":280,"content":"## ✅ Mark as Processed\nAfter successfully uploading the PDF and logging to sheets, the original email is marked as read so it won't be processed again.\n\n**Note:** Uses same Gmail credentials as trigger"},"typeVersion":1},{"id":"note6-7890-1234-f012-567890123456","name":"Sticky Note5","type":"n8n-nodes-base.stickyNote","position":[-272,336],"parameters":{"width":400,"height":424,"content":"## 🚀 Setup Instructions\n\n1. **Gmail OAuth2**: Connect your Gmail account in all Gmail nodes\n2. **Google Drive OAuth2**: Connect your Google Drive account\n3. **Google Sheets OAuth2**: Connect your Google Sheets account\n4. **Spreadsheet Setup**: \n - Create a Google Sheet\n - Add headers: Date, Sender, Subject, Filename, Drive_Link, File_ID, Email_ID\n - Copy the spreadsheet ID from the URL\n - Paste it in the Google Sheets node\n5. **Optional**: Change the Drive folder from 'root' to a specific folder ID\n6. **Test**: Send yourself an email with 'invoice' in subject and a PDF attached"},"typeVersion":1},{"id":"5f57d83d-03a6-4729-aa66-a8ad05d946d6","name":"If","type":"n8n-nodes-base.if","position":[672,304],"parameters":{"options":{},"conditions":{"options":{"version":2,"leftValue":"","caseSensitive":true,"typeValidation":"strict"},"combinator":"and","conditions":[{"id":"f8e67ccc-5871-4413-ad2a-57849477c0d8","operator":{"type":"boolean","operation":"true","singleValue":true},"leftValue":"={{ $binary && Object.keys($binary).length > 0 }}","rightValue":""}]}},"typeVersion":2.2}],"active":false,"pinData":{},"settings":{"timezone":"America/New_York","errorWorkflow":"","executionOrder":"v1","saveManualExecutions":true,"saveExecutionProgress":true,"saveDataErrorExecution":"all","saveDataSuccessExecution":"all"},"connections":{"If":{"main":[[{"node":"Upload to Google Drive","type":"main","index":0}]]},"Gmail Trigger":{"main":[[{"node":"Has PDF Attachments?","type":"main","index":0}]]},"Has PDF Attachments?":{"main":[[{"node":"If","type":"main","index":0}]]},"Log to Google Sheets":{"main":[[{"node":"Mark Email as Read","type":"main","index":0}]]},"Upload to Google Drive":{"main":[[{"node":"Log to Google Sheets","type":"main","index":0}]]}}} \ No newline at end of file