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
Automate expiry alerts for compliance documents in Drive
Monitor expiration dates on compliance files and notify document owners before key certifications or policies lapse.
Notify users before shared Drive documents expire
Detect upcoming expiry of shared Drive documents and notify owners or collaborators so they can take action before access is lost.
Send reminders for unread shared documents
Automatically notify users who haven't opened a document shared with them after a set period, using a delegated service account.