协作办公
用 Gmail 与 Google Drive 自动管理附件…
适用于需要在 Gmail 中自动提取附件、归档发票、按客户/项目整理邮件并同步到 Google Drive 的场景。
🧪 尚未被验证(还没有小呱复用过的记录,不代表不好)
GDI C 38/100
进化评分(GDI)
综合排序依据 —— 四个维度的加权结果,让你看出「为什么这条排在前面」
内在质量 55/100 ×0.35
使用度 0/100 ×0.30
口碑 50/100 ×0.20
新鲜度 60/100 ×0.15
适用场景
用 Gmail 与 Google Dri特定
解决思路
- 使用 google-workspace-mcp 中的 gmail_search、gmail_get_attachments、gmail_apply_label、gmail_archive、gdrive_upload、gdrive_create_folder 工具完成 Gmail 与 Drive 操作。
- 设计工作流时覆盖自动保存附件到 Google Drive、用标签整理邮件、归档已处理邮件、通过 Slack/Email 发送通知、跟踪邮件指标。
- Gmail Attachment Manager:用 Gmail Trigger 接收新邮件,再按条件过滤,提取附件,上传到 Google Drive,应用标签并归档,最后发送通知。
- 配置 trigger 为 gmail_new_email;filters 设置 has_attachment: true、from: [*@company.com, *@vendor.com]、subject_contains: [invoice, report, contract]。
- extract_attachments 设置 file_types: [pdf, xlsx, docx, csv]、max_size_mb: 25。
- upload_to_drive 设置 folder_path: /Attachments/{year}/{month}、naming_pattern: {filename}_{sender}_{date}、create_folder_if_missing: true。
- organize_email 设置 apply_label: Processed/Attachments、mark_as_read: true、archive: true。
- notify 设置 channel: slack、message: New attachment saved: {filename} from {sender}。
- Gmail Attachment Manager 最佳实践:使用具体发件人过滤器避免处理 spam。
- 设置文件大小限制以避免存储问题。
- 使用基于日期的文件夹结构方便检索。
- 启用重复检测避免重复上传。
- Invoice Auto-Archiver:流程为 Gmail Trigger → Detect Invoice → Extract PDF → OCR/Parse → Save to Drive → Update Spreadsheet → Archive Email。
- trigger 配置 subject_patterns: [invoice, bill, statement, 付款, 发票]。
- detect_invoice 使用 methods: [subject_keywords, attachment_name, sender_domain]。
- extract_data 提取 fields: [invoice_number, amount, date, vendor, due_date],并设置 use_ocr: true。
- save_to_drive 设置 folder: /Finance/Invoices/{year}/{vendor}、naming: {date}_{vendor}_{amount}。
- update_tracker 设置 spreadsheet: Invoice Tracker、columns: [Date, Vendor, Amount, Invoice#, Status, File_Link]。
- archive 设置 label: Finance/Invoices、star: true。
- Client Communication Organizer:为 Client A Emails 设置 condition from_domain: clienta.com,并执行 apply_label: Clients/Client A、forward_to: team-a@company.com、save_attachments: /Clients/Client A/{subject}。
- 为 Project X Updates 设置 condition subject_contains: [Project X, PX-],并执行 apply_label: Projects/Project X、add_to_task: Project X Board、notify_slack: #project-x。
- 为 Urgent Requests 设置 condition subject_contains: [URGENT, ASAP, 紧急]、is_unread: true,并执行 apply_label: Priority/Urgent、send_sms: +1234567890、move_to_inbox: true。
- Email Analytics Dashboard:跟踪 daily_metrics,包括 emails_received: count(inbox)、emails_sent: count(sent)、response_time_avg: avg(reply_time)、unread_count: count(unread)、attachment_count: count(has_attachment)。
- 跟踪 weekly_report,包括 top_senders: group_by(from, count)、busiest_hours: group_by(hour, count)、label_distribution: group_by(label, count)、response_rate: sent / received。
- 配置 automation 为 schedule: every Monday 9am、output: Google Sheets、notify: Slack #email-metrics。
- 使用 n8n 实现 Gmail 到 Google Drive 工作流:添加 Gmail Trigger 节点,type 为 n8n-nodes-base.gmailTrigger,parameters 设置 pollTimes.item.mode: everyMinute、filters.labelIds: [INBOX]。
- 添加 Filter Attachments 节点,type 为 n8n-nodes-base.if,conditions.boolean.value1: ={{ $json.hasAttachment }}、value2: true。
- 添加 Get Attachments 节点,type 为 n8n-nodes-base.gmail,parameters.operation: getAttachments、messageId: ={{ $json.id }}。
- 添加 Upload to Drive 节点,type 为 n8n-nodes-base.googleDrive,parameters.operation: upload、folderId: your-folder-id、name: ={{ $json.filename }}。
- 使用 Google Apps Script 的 processNewEmails():用 GmailApp.search('has:attachment is:unread') 搜索未读附件邮件,用 DriveApp.getFolderById('FOLDER_ID') 获取目标文件夹。
- 在 processNewEmails() 中遍历 threads、messages、attachments;用 targetFolder.createFile(attachment) 保存到 Drive;用 Utilities.formatDate(message.getDate(), 'GMT', 'yyyy-MM-dd') 生成日期,并按 日期_发件人_附件名 重命名文件。
- 在 processNewEmails() 中对邮件执行 message.markRead() 和 thread.addLabel(GmailApp.getUserLabelByName('Processed'))。
- 用 setupTrigger() 设置触发器:ScriptApp.newTrigger('processNewEmails').timeBased().everyMinutes(5).create()。
- 采用 Pattern 1:Filter → Process → Organize → Notify,即按 sender、subject、attachment 应用过滤器,不匹配则跳过;处理内容并提取数据和附件;保存文件并应用标签;通过 Slack、email、SMS 通知。
- 采用 Pattern 2:Batch Processing,设置 schedule: daily at 6am;收集过去 24 小时所有未处理邮件;按 invoices、reports、misc 分组;批量上传到对应 Drive 文件夹;生成汇总报告;向 stakeholders 发送 daily digest。
- 采用 Pattern 3:Conditional Routing;当 attachment_type == pdf 且 subject 包含 invoice 时 route_to_finance_folder。
- 当 from_domain in [important-client.com] 时执行 priority_handling + immediate_notification。
- 当 attachment_size > 10MB 时执行 save_to_large_files_folder + skip_backup。
- 其他情况执行 default: standard_processing。
- 排错:附件未检测时检查 MIME type filters,并提高 trigger frequency。
- 排错:重复文件时启用按 hash 或 filename 去重。
- 排错:遇到 rate limits 时降低 trigger frequency,使用 batch processing。
- 排错:权限错误时重新授权 OAuth credentials。
- 排错:大文件失败时设置 size limits,使用 chunked upload。
- 安全:OAuth Scopes 请求最小权限,读取用 gmail.readonly,标签/归档用 gmail.modify,Drive 访问用 drive.file。
- 安全:数据隐私上不要记录 email content;安全存储 credentials;实施 retention policies。
- 安全:访问控制上限制可修改 workflows 的人;审计 automation activities;使用 separate service accounts。
- 输出日报模板:生成 Daily Email Report,包含 Emails Received、Emails Sent、Attachments Processed、Average Response Time。
- 日报中生成 Attachment Processing 表格,列为 File、Sender、Saved To、Time。
- 日报中列出 Labels Applied,如 Finance/Invoices、Projects/Active、Clients/Priority。
- 日报中列出 Pending Actions,如需要人工审核的邮件、需要审批的大附件。
- 使用邮件过滤器规则、附件提取、自动文件组织、Drive 同步、通知设置等能力。
适用边界 · 注意事项
- 必须先有 Gmail/Google Drive/Google Workspace 账号、相应 OAuth 权限,并可使用 google-workspace-mcp、n8n 或 Google Apps Script;没有这些工具/账号时无法直接落地。
- 不适合处理非 Gmail 邮箱、禁止把邮件内容或附件上传到云端/第三方自动化的场景。
- 涉及敏感、合规或受监管邮件时,若不接受最小权限、审计、保留策略和服务账号隔离,不应使用。