First up, here’s a high-level overview of what we are going to do.
Create a new rule in Gmail to automatically label emails that we forward to a specific address as “FOIA”
Then, we are going to create an automation through Google Apps Script that looks for new emails with the “FOIA” label
When one appears, it will check to see if the subject line of that email matches a MY_ID in our Super Dope FOIA tracking spreadsheet.
If it does, the script will create a new Google Drive folder on our drive with this naming convention: MY_ID - Summary
So for example: 2022000 - Squirrel data
Within that folder, our script will put two things:
A copy of the new email that was labeled with “FOIA” in a Google Doc form (helpful because Google Drive doesn’t count Google Docs against your overall storage like it does with PDFs)
Any attachments to that Email (AKA, probably the responsive records for your FOIA)
Then, the script goes back to our Super Dope FOIA Tracking Spreadsheet, and adds in URLs to:
A direct link to the actual email thread in gmail
A link to the newly created folder that corresponds to that row
And that’s it! So once you have this set up, this would be your workflow for processing new FOIA responses.
You receive an email with your responsive records. Yay! Hopefully the files are just attached to the email, but if they provide links for you to download them, you’ll need to do that at this time.
Go to your FOIA Tracking Spreadsheet and figure out what the MY_ID is for this request.
Back in email, forward the whole thing to your Gmail alias for FOIAs. In the subject line, delete anything that is already there and replace it with only your MY_ID.
Then your work is done and the automations kick in to create the folder, store your records and add the links to your spreadsheet. So go back and check them out whenever you’re ready.
The Actual Steps
Okay hopefully you’re excited about this possibility. Let that fuel you through this part of the process.
First up, you need to make a folder on google drive where you want to store all of your FOIA responses. This is going to be the umbrella folder that contains all of the sub-folders with your MY_IDs and responsive records. I recommend making it in the same spot you store your Google Form and Tracking Google Sheet.
Then, you need to get the Folder ID for that new umbrella folder, as well as the Spreadsheet ID from your Super Dope FOIA Tracking Sheet. I’ll explain where to find both below, but I recommend you copy and paste both somewhere you can reference again.
Folder ID:
Go to the folder you just created to store all of your FOIA response sub-folders. In the URL, copy everything after folders/
Spreadsheet ID
Go to your spreadsheet and copy everything after d/ and before /edit
Finally, forward a test email to your new FOIA gmail alias with an MHID that is in your existing FOIA tracking spreadsheet. So you could go with 2024000 to be safe since that is in the template. Include a random file as an attachment. This is just to test our script once we get it going. Note: don’t open it in your gmail, we want it to remain unread.
Go to your Google Sheet and select “Extensions” from the menu bar, then “Apps Script.” You’ll then get to a screen that looks like this.
Rename the script to something that makes sense, like “FOIA automation script”