The Limitations of Out-of-the-Box Google Forms
Google Forms is ideal for capturing employee expense requests, leave applications, and equipment requisitions. However, standard Forms lacks native approval routing: managers cannot approve or deny requests directly from email, and employees have no visibility into request status. By pairing Forms with Google Apps Script, you can construct an automated enterprise approval pipeline with 1-click email action buttons.
Architecture: In-Email Approval Links
When an employee submits a form:
- Google Forms records the entry in the linked Google Sheet.
- An Apps Script
onFormSubmittrigger executes, generates a secure random UUID token, and records the request as "Pending Manager Approval". - The script sends an HTML email to the employee's manager with two action links:
ApproveandReject, carrying the unique request ID and secure token in URL parameters pointing to a deployed Apps Script Web App. - When the manager clicks a link, the Web App updates the spreadsheet row status and dispatches a notification email back to the employee.
Complete Apps Script Implementation
/**
* Triggered on Google Form submission
*/
function onFormSubmit(e) {
const sheet = SpreadsheetApp.getActiveSpreadsheet().getActiveSheet();
const row = e.range.getRow();
const values = e.values; // Form submission values array
const timestamp = values[0];
const employeeEmail = values[1];
const requestDescription = values[2];
const amount = values[3];
const managerEmail = values[4];
// Generate unique approval token
const requestId = Utilities.getUuid();
sheet.getRange(row, 6).setValue("Pending Approval");
sheet.getRange(row, 7).setValue(requestId);
const webAppUrl = "YOUR_DEPLOYED_WEB_APP_URL_HERE";
const approveUrl = `${webAppUrl}?action=approve&id=${requestId}`;
const rejectUrl = `${webAppUrl}?action=reject&id=${requestId}`;
const htmlBody = `
<h3>New Approval Request from ${employeeEmail}</h3>
<p><strong>Description:</strong> ${requestDescription}</p>
<p><strong>Amount:</strong> $${amount}</p>
<div style="margin-top: 20px;">
<a href="${approveUrl}" style="background-color: #15803d; color: white; padding: 10px 20px; text-decoration: none; border-radius: 5px; margin-right: 15px;">Approve Request</a>
<a href="${rejectUrl}" style="background-color: #b91c1c; color: white; padding: 10px 20px; text-decoration: none; border-radius: 5px;">Reject Request</a>
</div>
`;
GmailApp.sendEmail(managerEmail, `Approval Required: ${requestDescription} - $${amount}`, "", { htmlBody: htmlBody });
}
/**
* Web App Endpoint handling manager clicks
*/
function doGet(e) {
const action = e.parameter.action;
const id = e.parameter.id;
const sheet = SpreadsheetApp.getActiveSpreadsheet().getActiveSheet();
const data = sheet.getDataRange().getValues();
for (let i = 1; i < data.length; i++) {
if (data[i][6] === id) {
const currentStatus = data[i][5];
if (currentStatus !== "Pending Approval") {
return ContentService.createTextOutput("This request has already been processed: " + currentStatus);
}
const newStatus = action === "approve" ? "Approved" : "Rejected";
sheet.getRange(i + 1, 6).setValue(newStatus);
sheet.getRange(i + 1, 8).setValue(new Date());
// Notify employee
GmailApp.sendEmail(data[i][1], `Your Request Has Been ${newStatus}`, `Your request "${data[i][2]}" was ${newStatus.toLowerCase()} by your manager.`);
return ContentService.createTextOutput(`Success: Request has been marked as ${newStatus}.`);
}
}
return ContentService.createTextOutput("Error: Request ID not found.");
}
Frequently Asked Questions
How do I deploy the Apps Script Web App?
In Apps Script editor, click Deploy > New deployment, select Web app, set Execute as: Me, and set Who has access: Anyone so external managers can click approval links from their email client.
Can this workflow support two levels of management approval?
Yes. If the amount exceeds a specified budget threshold (e.g. $5,000), the Web App can update status to "Pending Director Approval" and automatically trigger a second approval email to the finance director.