Use cases → Documents and Drive
Automate migration of user Drive and mail with domain delegation
Bulk-migrate Drive files and Gmail messages between accounts or domains without user involvement, handling real-world volume and edge cases.
| Who it is for | IT and automation teams migrating data at scale for onboarding, offboarding, or domain consolidation. |
|---|---|
| APIs | Drive API, Gmail API |
| Typical scopes | drive, gmail.readonly, gmail.insert |
The problem
Manual data migration is slow, error-prone and unscalable, especially when moving hundreds of user accounts or entire departments. Users may not have time or knowledge to handle exports, and leaving data behind can break business continuity.
How it works
- Grant domain-wide delegation to a service account with the necessary scopes.
- Impersonate each source user in turn to enumerate and export their Drive files and Gmail messages.
- Impersonate the destination user to import content, preserving metadata where possible.
- Track processed items to avoid duplicates and ensure idempotency.
- Log and retry failures, especially for large attachments and shared files.
What changes
Large-scale data moves complete without user action, preserving ownership and audit trails, and reducing downtime during user transitions.
Watch it explained
“How to Migrate Users in 24 Hours to Google Workspace ?” — Google Workspace Admin on YouTube. Third-party video, included because it covers this ground well. We are not affiliated with the channel.
Questions people ask
Can you preserve original timestamps and folder structure?
Timestamps can be preserved on Gmail messages using gmail.insert with appropriate headers, but Drive file creation dates cannot be set via the API. Folder structures require careful mapping and recreation on the destination.
How do you handle mail labels and threading?
Labels can be mapped and recreated, but system labels may not transfer directly. Threading is not preserved unless you carefully insert messages in order with correct headers.
Want this built?
This is a pattern we run in production. We will set up the delegation and build this on top of it — $500 per hour, most of it working the same day.
Talk to us Or read the setup guideRelated use cases
Send access alerts for sensitive Drive files in context
Alert the right people when a sensitive file is accessed, including file details and triggering context, using a delegated service account.
Notify the owner when a document is untouched for 90 days
Alert document owners before files are forgotten by tracking Drive activity and sending targeted notifications when a document hasn't been opened in 90 days.
Route inbound CVs into a hiring pipeline folder
Automatically collect candidate CVs from email and place them in a shared Drive folder for the hiring team.