Save security report attachments to shared drive folder
When a security report email arrives, its attachments are saved to your shared drive folder with the received date, and the email is labelled so it is clearly processed.
Install it
Set up this Zap for me, read how here: https://zapier.sh/zapier/awesome-zaps/save-security-report-attachments-to-shared-drive-folder/
Paste into Claude, ChatGPT, Cursor or any agent.
- Category
- IT · Security compliance
- Author
- Zapier
- Source
- zapier/awesome-zaps, folder zaps/save-security-report-attachments-to-shared-drive-folder
Set it up with the CLI
- Add it. Copies the folder into
zaps/save-security-report-attachments-to-shared-drive-folder/. Outside a project, it makes one first.npx zap-pack add awesome-zaps/save-security-report-attachments-to-shared-drive-folder - Fill in the values in
config.ts, and in any other file the list marks. Replace each one as its comment and SKILL.md say. - Deploy it. Asks for any value still left, signs you in to Zapier if you aren't, then publishes it to your account.
npx zap-pack deploy save-security-report-attachments-to-shared-drive-folder - Check it. Its recent runs, with status and errors.
npx zap-pack logs save-security-report-attachments-to-shared-drive-folder
zaps/save-security-report-attachments-to-shared-drive-folder/
- README.mdWhat it does, for people
- SKILL.mdHow an agent sets it up: what to ask you, and how to test it
- config.tsIts settings 5 to fill in
- connections/gmail.tsThe
gmailaccount it uses - connections/google-drive.tsThe
google-driveaccount it uses - triggers/search.tsWhat starts it:
gmailsearch1 to fill in - workflow.tsThe code; each
ctx.stepis a step in the Zap
Agents: add --yes to any command so it never prompts. When it needs an answer only the user can give, it stops and names the flag that supplies it.
SKILL.md
View MarkdownWhat it does
- Trigger: a new Gmail email matching a search string arrives (
gmail,search). - Filter (in code): the subject must contain the configured text and the To header must contain the configured recipient. Messages with no attachments stop here.
- Google Drive uploads each attachment to the configured folder, named
<received date>_<original filename>. A failed upload is counted, and the run continues with the next attachment. - Gmail adds the processed label to the message, but only if every upload succeeded. Otherwise the message is left unlabelled so the next run can retry it.
The Zap never sends, moves or deletes email. Its only Gmail action is adding the label.
Ask the user
Each REPLACE_… value is set per person. Resolve names to IDs with the user's own connections; don't ask them to paste an ID you can look up.
| Setting | Where | What goes there |
|---|---|---|
SEARCH_QUERY |
config.ts, and query in triggers/search.ts |
The Gmail search that finds the report emails, in Gmail search syntax |
SUBJECT_CRITERIA |
config.ts |
Text the subject must contain before attachments are saved |
RECIPIENT_PATTERN |
config.ts |
Text the To header must contain, such as the receiving mailbox address |
DRIVE_FOLDER_ID |
config.ts |
The Drive folder that receives the files, by its ID (the long ID in its URL). The folder must already exist |
PROCESSED_LABEL_ID |
config.ts |
The Gmail label added to processed messages. The label must already exist |
Also review the default with them: SHARED_DRIVE_ID is empty, which uploads to My Drive. Set it to a shared drive's ID to upload there instead.
Build it
If you can run shell commands, set it up with zap-pack: run npx zap-pack add awesome-zaps/save-security-report-attachments-to-shared-drive-folder, replace each REPLACE_… value as this file says, then run npx zap-pack deploy save-security-report-attachments-to-shared-drive-folder, which signs the user in to Zapier when it gets there. Otherwise build with Zapier MCP, as the steps below say. No Zapier MCP tools? Read https://docs.zapier.com/mcp/get-started/quickstart.md and follow the page for the app you are running in to get the user connected, then continue with this build.
- Accounts: bind
gmail(the Gmail account that receives the reports) andgoogle-drive(the Google account that owns the destination folder) to the user's connections. Bindgoogle-drivebefore publishing; the workflow cannot upload without it. - Source: publish
workflow.tsandconfig.ts, with eachREPLACE_…replaced by the user's answer.triggers/search.tsandconnections/are settings, not code: set the workflow's trigger and connection bindings from them, and set the trigger'squeryto the same search asSEARCH_QUERY. The trigger file names the app by its slug; for the trigger'sselected_api, callsearch_triggerswith that slug, find the row whosekeyis the trigger'sevent, and use<app_key>@<app_version>from it. - Build guide: load Zapier's build guide with
get_zapier_skill("zapier:build-workflows")and follow it to create, test and publish the workflow. - Fields: inspect each action's fields with the user's connections, and sample the trigger, before the first test run, and fix any key in
workflow.tsthat doesn't match.
Test it
Run this sample as a draft test (run_workflow_draft in Zapier MCP). It does not match the filter, so it writes nothing:
{
"id": "example-message-id",
"subject": "Lunch plans",
"to": "you@example.com",
"date": "2026-10-29T10:00:00Z",
"attachments": []
}
Confirm the run completes with reason: "subject-or-recipient-did-not-match", and that no file was added to the folder and no label was added. Then run a second sample against a test email you control: send it to your own address, with the subject text and one attachment, and give the attachment's url. Check that the file appears in the folder with the date-prefixed name and that the message gets the processed label. Publish once both runs pass, and confirm the trigger is active.
If run-status tools aren't available, check the result in Gmail and Google Drive directly. The user deletes the test file and label afterwards, not the agent.
Notes
- The attachment fields
urlandfilenamewere assumed from the Gmail trigger payload, because the sample read returned no records. Check them on the first real run. - Drive allows duplicate file names, so a second report with the same name and date creates a second file rather than overwriting.
- A message with several attachments is processed as one run. If any upload fails, the message stays unlabelled and the next matching run tries again, which can re-upload the attachments that already succeeded.
- To log uploads to a tracking sheet or ticketing system, add a step after the uploads. To name files by source email and timestamp, change
new_nameinworkflow.ts. - Folder IDs, label IDs and email addresses belong to the user's account. Don't commit them.