A web-based user onboarding tool for Google Workspace administrators built with Google Apps Script.
- ✅ User-friendly web form with modern Material Design UI
- 🔍 Manager autocomplete with live search functionality
- 📋 Organizational unit selection dynamically loaded from Google Workspace
- ✏️ Client-side validation for all form fields
- 📱 International phone number support with country code dropdown
- 🎯 Auto-appending email domain for primary email addresses
- ✨ Loading animations and success/error modals
- 🔒 Super admin requirement with warning banner
- Google Workspace account with Super Admin privileges
- Access to Google Apps Script
- Admin SDK Directory API enabled
- Go to script.google.com
- Click New Project
- Give your project a name (e.g., "Workspace Onboarding")
- In your Apps Script project, click + next to Files
- Select HTML
- Name it
Index(or any name you prefer) - Copy the contents of
index.htmlinto this file
- In your Apps Script project, open
Code.gs - Copy the contents of 'main.gs' into this file
- Rename 'Code.gs' to 'main.gs' as you like.
Update the following in the HTML file:
-
Line 402: Replace the logo URL
<img src="YOUR_LOGO_URL_HERE" alt="Company Logo">
-
Line 449: Update the email domain suffix
<span class="email-suffix">@yourdomain.com</span>
-
Line 420-427: Customize department options
<option value="Marketing">Marketing</option> <option value="Sales">Sales</option> <!-- Add your departments here -->
-
Line 755: Update email domain in auto-append function
this.value = this.value + '@yourdomain.com';
- Click Deploy > New deployment
- Select type: Web app
- Configuration:
- Execute as: Me
- Who has access: Anyone within your organization
- Click Deploy
- Copy the web app URL
- In Apps Script editor, click Services (+)
- Find and add Admin SDK API
- Click Add
## Usage
1. Share the web app URL with your HR team or administrators
2. Users fill out the form with new employee information
3. Click "Create User" to provision the account
4. Success modal displays the created user details
5. New user receives a welcome email (if configured)
## Form Fields
| Field | Required | Description |
|-------|----------|-------------|
| First Name | Yes | Employee's first name (max 30 chars) |
| Last Name | Yes | Employee's last name (max 30 chars) |
| Title | Yes | Job title (max 30 chars) |
| Department | Yes | Select from dropdown |
| Primary Email | Yes | Username only, domain auto-appended |
| Secondary Email | Yes | Recovery/personal email address |
| Phone Number | Yes | With country code, 7-12 digits |
| Organizational Unit | Yes | Selected from workspace OUs |
| Manager | Yes | Search by name or email |
## Security Notes
- Only **Super Admins** can create users
- Form validates admin status before user creation
- Temporary passwords are randomly generated (16 characters)
- Users must change password on first login
- All API calls are server-side for security
## Customization
### Add Custom Fields
To add custom fields to the user object:
1. Add the form field in the HTML
2. Update the `formData` object in the submit handler
3. Modify the `createUser` function to include the new field
### Styling
The form uses Google Material Design principles. Colors and styles can be customized in the `<style>` section.
### Email Templates
Customize the welcome email in the `sendWelcomeEmail` function.
## Troubleshooting
### "Only super admins can use this tool"
- Ensure you're logged in with a Super Admin account
- Check that Admin SDK is enabled in your project
### "Failed to load OUs"
- Verify Admin SDK API is added to your project
- Check that the script has proper permissions
- Try re-deploying the web app
### Manager autocomplete not working
- Ensure `getAllUsers()` function is implemented
- Check browser console for JavaScript errors
- Verify users exist in your workspace
### User creation fails
- Check Apps Script execution logs for errors
- Verify all required fields are filled
- Ensure email address isn't already in use
- Confirm organizational unit path is valid
## License
MIT License - Feel free to modify and use for your organization.
## Support
For issues or questions, check the [Google Apps Script documentation](https://developers.google.com/apps-script) or [Admin SDK documentation](https://developers.google.com/admin-sdk).
