Published: September 2025 · Author: GWS Automate
When an employee leaves, IT admins must secure their Google Workspace account quickly. Delays can mean lingering access to email, documents, and company data. In this post, I’ll walk through how to automate Workspace offboarding with Apps Script to reduce errors and save hours.
Manual offboarding often looks like a checklist:
When rushed, steps get skipped — creating security risks and lost data.
Automation ensures every step happens the same way, every time. By using Google Apps Script with the Admin SDK, IT admins can:
function suspendUser(userKey) { var user = { suspended: true }; AdminDirectory.Users.update(user, userKey); }
function transferDrive(oldUser, newOwner) { AdminDirectory.Files.insert({ oldOwnerUserEmail: oldUser, newOwnerUserEmail: newOwner }); }
function setForwarding(userKey, forwardTo) { Gmail.Users.Settings.ForwardingAddresses.create( { forwardingEmail: forwardTo }, userKey ); }
Set a vacation responder letting contacts know the employee has left and who to reach instead.
Loop through groups and remove the user automatically.
With automation, offboarding went from a 25-minute checklist to a single script execution. IT admins save hours weekly and reduce the chance of sensitive accounts being left active.
Manual offboarding creates risk. Automating it with Apps Script ensures consistency, security, and peace of mind. Combined with onboarding automation, IT admins can save 10+ hours per week.
Next step: Want prebuilt scripts and templates for onboarding & offboarding? Check out our Starter Pack or Pro Pack.