Google Vault query builder and export scoping workbench
Build a Vault search, preview how much data it would actually pull, tighten it until the scope is defensible, and only then run the export.
Build me a search and export scoping workbench for Google Vault. Today my team guesses at scope, fires an export, and discovers hours later that it was far too broad, which costs real money once the data hits processing and hosting. I want one screen where I build a query, preview how much it would actually return, tighten it, and only then export. Load the matters I have access to with List Matters and let me pick which matter I am working in from a selector at the top of the app. Everything else in the app is scoped to the selected matter.
The main surface is a query builder. Let me pick the data source (corpus): Mail, Drive, Groups, Chat, Voice, Calendar, or Gemini. Let me pick the search method: specific accounts as a list of email addresses, an org unit, a shared drive, a Chat room, or entire org for Gmail only. Let me set a start time, an end time, an IANA time zone such as America/New_York, and free text search terms using the service specific operators. Surface the per source options that actually change results: exclude drafts for Mail, include shared drives for Drive, include rooms for Chat, and a data scope selector for all data, held data, or unprocessed data. Hold the builder state as a single Query object and reuse it verbatim for counts, saved queries, and exports so what I previewed is exactly what I save and export.
A Preview volume button runs Count Accounts with the current query, then polls Get Operation on the returned operation name until it reports done, showing a live counting state while it waits. When it finishes, render the result counts in a comparison table broken out per account and per data source. Keep the last several previews as rows in that table so I can see how a change to terms or dates moved the volume, and let me re run a count after editing without losing the earlier rows. That side by side comparison is the point of the app: I tighten and re count until the scope is defensible and affordable.
A sidebar lists my reusable saved queries for the selected matter with List Saved Queries. Clicking one loads it back into the builder with Get Saved Query, and each row has a delete action using Delete Saved Query behind a confirm. When a query looks right, a Save to matter button persists it with Create Saved Query under a name I type, so the next request starts from a known good scope instead of a blank page.
A separate Exports tab lists everything in flight and finished for the matter with List Exports, and refreshes individual rows with Get Export. Show status, export size, and item counts on every row. Give me a button to launch a new export from a saved query with Create Export, and a button to clean up old exports with Delete Export behind a confirm.
Add a Scope this request button that kicks off a background agent. I paste a plain English discovery or privacy request, for example everything Dana sent or received about the Northwind contract between March and June. The agent drafts candidate queries for each relevant data source, runs Count Accounts on each candidate and polls Get Operation until done, compares the volumes across candidates, and saves the best scoped query to the matter with Create Saved Query. It then writes a scoping memo into Google Docs: Create Document for a titled memo, then Batch Update Document to fill in what it searched, the volumes it found for each candidate, which query it recommends, and what it recommends exporting and why. Show the agent progress in the app, and when it lands, link the finished memo and the new saved query from the workbench.
Bake in the real constraints. Counts and exports are long running operations, so never read a result directly: always poll Get Operation until it reports done, with a visible waiting state and a sensible timeout rather than an indefinite spinner. Vault allows roughly 60 queries per 100 seconds, so stagger repeated counts instead of fanning out hard, especially while the agent is counting several candidates at once. An export running past 24 hours can come back partial and need a re run, so warn about that on the exports tab and flag any export that has been running a long time. Gemini supports search and export only, not holds, and Gemini exports are XML output, so note that in the builder whenever Gemini is the selected data source.
What does this prompt do?
- Build a Vault search in one place: pick the data source (Mail, Drive, Groups, Chat, Voice, Calendar, or Gemini), who or where to search, a date range with time zone, and your search terms.
- Preview the volume before you commit. One click counts what the search would actually return and shows the per account and per data source numbers in a comparison table, so you can tighten terms and dates and re-count until the scope holds up.
- Save the searches that work to a matter and reuse them later, and run every export from the same screen with live status, size, and item counts.
- Paste a plain English discovery or privacy request and a background agent drafts candidate searches, compares their volumes, saves the tightest one, and writes a scoping memo into Google Docs.
What do I need to use this?
- A Google Workspace account with Google Vault access, and permission to run searches and exports
- At least one matter already set up in Vault to work inside
- A Google account that can create Google Docs, so the agent can write its scoping memo
How can I customize it?
- Default the date range, time zone, and data sources to whatever your legal team uses most, so a new search starts closer to the right shape
- Set your own volume thresholds so the workbench flags a search as too broad before anyone runs an export
- Adjust what the scoping memo covers, including how the agent justifies its recommendation and what it tells reviewers to export
FAQs
Why does the volume preview take a moment to come back?
Will this stop me from running an export that is too big?
What happens if an export runs for more than 24 hours?
Does this work with Gemini data?
Do I need to create matters inside this app?
Related templates
Pick creators from your saved list and see their best and worst Instagram posts side by side, so your brief is built on what actually lands.
Pick a client and a date range to see organic trends, paid campaigns and every post ranked best to worst, then generate the client report.
See every employee by department with pay, tenure and time since their last raise, model increases live, then apply only what you approve back to Gusto.
Let anyone request a short avatar video, get the script drafted from your own document, and approve every take before it ships to Slack.
Every client site on one grid with the biggest drops first, plus a one-click monthly recap written up and posted to that client's channel.
A board of job cards for every site album, with inline captions and a one click assistant that writes the dated progress report and posts it to your project channel.
Stop finding out six hours later that your export was too broad.
Preview the volume, tighten the scope, then export once with confidence.